Cod sursa(job #2678766)

Utilizator TomKodeColev Thomas-Daniel TomKode Data 28 noiembrie 2020 17:15:59
Problema Cutii Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.86 kb
#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
}