Pagini recente » Cod sursa (job #171707) | Cod sursa (job #1827676) | Cod sursa (job #1024791) | Cod sursa (job #2792727) | Cod sursa (job #2678779)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("cutii.in");
ofstream fout("cutii.out");
#define START ios::sync_with_stdio(false); fin.tie(0) ; fout.tie(0) ;
#define FINISH fin.close() ; fout.close();
struct cutii
{
int x,y,z;
} v[3505];
bool compare(cutii a,cutii b)
{
return a.x < b.x and a.y < b.y and a.z < b.z ;
}
int main()
{
START
int n, teste , maxx,l;
fin>>n>>teste;
vector <int> dp(n,0);
dp.at(0) = 1;
while(teste--)
{
maxx=INT_MIN;
l=0;
for(int i=0;i<n;i++)
{
fin>>v[i].x>>v[i].y>>v[i].z;
}
sort(v,v+n,compare);
for(int i=1;i<n;i++)
{
for(int j=0;j<i;j++)
{
if(v[i]. x > v[j] . x and v[i].y > v[j] . y and v[i] . z > v[j] . z )
if(l<dp.at(j))
l=dp.at(j);
}
dp.at(i)= l+1;
maxx=max(maxx,l+1);
}
fout<<maxx<<"\n";
}
FINISH
}