Pagini recente » Cod sursa (job #1923845) | Cod sursa (job #2254017) | Cod sursa (job #1102022) | Cod sursa (job #2286445) | Cod sursa (job #2678766)
#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 , lastx , lasty , lastz;
fin>>n>>teste;
while(teste--)
{
for(int i=0;i<n;i++)
{
fin>>v[i].x>>v[i].y>>v[i].z;
}
sort(v,v+n,compare);
maxx=1;
lastx = v[0].x;
lasty = v[0].y;
lastz = v[0].z;
for(int i=1;i<n;i++)
{
if(v[i].x < lastx and v[i].y < lasty and v[i].z < lastz)
{
maxx++;
lastx = v[i].x;
lasty = v[i].y;
lastz = v[i].z;
}
}
fout<<maxx<<"\n";
}
FINISH
}