Pagini recente » Cod sursa (job #1233176) | Clasament minune1 | Cod sursa (job #1022488) | Cod sursa (job #2801144) | Cod sursa (job #40921)
Cod sursa(job #40921)
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define Nmax 3501
#define fin "cutii.in"
#define fout "cutii.out"
#define x first
#define y second.first
#define z second.second
#define all(x) x,x+n
#define FOR(i,a,b) for(i=(a);i<(b);++i)
#define cmp(i,j) ((c[i].y > c[j].y) && (c[i].z > c[j].z))
pair< int , pair<int,int> > c[Nmax];
int x[Nmax];
int main()
{
freopen(fin,"r",stdin);
freopen(fout,"w",stdout);
register int n,t,i,j, Max,sol;
scanf("%d%d", &n, &t);
do
{
--t;
FOR(i,0,n)
scanf("%d%d%d", &c[i].x, &c[i].y, &c[i].z);
sort(all(c));
sol = 0;
FOR(i,0,n)
{
Max = 0;
FOR(j,0,i)
if(cmp(i,j) && (x[j]>Max))
Max = x[j];
x[i] = ++Max;
if(sol < Max)
sol = Max;
}
printf("%d\n", sol);
}while(t);
return 0;
}