Pagini recente » Cod sursa (job #1409184) | Cod sursa (job #1044384) | Cod sursa (job #1785134) | Cod sursa (job #2756061)
#include<bits/stdc++.h>
using namespace std;
#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
//#define int ll
int t, n, x[3501], y[3501], z[3501];
vector<int> g[3501];
int d[3501];
bool v[3501];
ifstream fin("cutii.in"); ofstream fout("cutii.out");
#define cin fin
#define cout fout
void dfs(int s){
v[s]=true;
for(auto u:g[s]){
dfs(u);
d[s]=max(d[s], d[u]+1);
}
}
int32_t main(){
INIT
cin>>n>>t;
while(t--){
for(int i=1; i<=n; i++){
cin>>x[i]>>y[i]>>z[i];
g[i].clear();
d[i]=1;
v[i]=false;
}
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if( (x[j]<x[i]) && (y[j]<y[i]) && (z[j]<z[i]) ){
g[i].pb(j);
}
}
}
int res=0;
for(int i=1; i<=n; i++){
if(!v[i]){
dfs(i);
res=max(res, d[i]);
}
}
cout<<res<<"\n";
}
return 0;
}