Pagini recente » Cod sursa (job #3206588) | Cod sursa (job #2619770) | Cod sursa (job #2212564) | Cod sursa (job #2168157) | Cod sursa (job #3186846)
#include <fstream>
#include <cstring>
using namespace std;
ifstream cin("cutii.in");
ofstream cout("cutii.out");
int n,t,i,d[3502];
struct cub{
int x,y,z;
}c[3502];
bool verif(int i,int j){
return c[i].y>c[j].y&&c[i].z>c[j].z;
}
void quicksort(){
// lipseste algoritmul pentru sortare quicksort
}
int sclm(){
int k=0;
d[1]=1;
for(int i=2;i<=n;i++){
d[i]=1;
for(int j=1;j<i;j++)
if(verif(i,j)&&d[j]+1>d[i])
d[i]=d[j]+1;
k=max(k,d[i]);
}
return k;
}
int main()
{
cin>>n>>t;
while(t--){
for(i=1;i<=n;i++)
cin>>c[i].x>>c[i].y>>c[i].z;
quicksort();
cout<<sclm()<<'\n';
}
return 0;
}