Pagini recente » Rating Bordi Eszter (Eszti) | Cod sursa (job #1403502) | Cod sursa (job #68892) | Cod sursa (job #2416910) | Cod sursa (job #365303)
Cod sursa(job #365303)
#include <cstdio>
#include <cstring>
#define file_in "cutii.in"
#define file_out "cutii.out"
int N,T,i,j,best[10000],x,y,z,v[10100],cmax;
int main()
{
freopen(file_in,"r",stdin);
freopen(file_out,"w",stdout);
scanf("%d %d", &N, &T);
while(T--)
{
for (i=1;i<=N;++i)
{
scanf("%d %d %d", &x, &y, &z);
v[i]=x*y*z;
}
cmax=0;
memset(best,0,sizeof(best));
best[N]=1;
for (i=N-1;i>=1;--i)
{
best[i]=1;
for (j=i+1;j<=N;++j)
if (v[i]<v[j] && best[i]<best[j]+1)
best[i]=best[j]+1;
if (best[i]>cmax)
cmax=best[i];
}
printf("%d\n", cmax);
}
fclose(stdin);
fclose(stdout);
return 0;
}