Cod sursa(job #1660176)

Utilizator NicolaalexandraNicola Alexandra Mihaela Nicolaalexandra Data 22 martie 2016 21:05:05
Problema Cutii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.83 kb
#include <fstream>

#include <algorithm>

using namespace std;

int n,i,d,x,y,z,maxim,ap,t;

pair < pair <int, int> , pair <int, int> > v[3510];

ifstream fin ("cutii.in");

ofstream fout ("cutii.out");

int main (){

    fin>>n>>t;
    for (d=1;d<=t;d++){
        for (i=1;i<=n;i++)
            fin>>v[i].first.first>>v[i].first.second>>v[i].second.first;
        sort (v+1,v+n+1);
        x = v[1].first.first;
        y = v[1].first.second;
        z = v[1].second.first;
        ap = 1;
        for (i=2;i<=n;i++){
            if (v[i].first.first > x && v[i].first.second > y && v[i].second.first > z){
                ap++;
                x = v[i].first.first;
                y = v[i].first.second;
                z = v[i].second.first;
            }
        }
        fout<<ap<<"\n";
    }

    return 0;
}