Cod sursa(job #2959419)

Utilizator YosifIosif Andrei Stefan Yosif Data 31 decembrie 2022 01:20:31
Problema Cutii Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.89 kb
#include<bits/stdc++.h>
using namespace std;

ifstream fin("cutii.in");
ofstream fout("cutii.out");

struct nod {
    int a, b, c;

    bool operator < (nod& aux)
    {
        return a < aux.a && b < aux.b && c < aux.c;
    }

    void operator () (int a, int b, int c)
    {
        this->a = a;
        this->b = b;
        this->c = c;
    }
};

int t, n, d[3501];
nod v[3501];

int main()
{
    fin >> n >> t;

    for (int k = 1; k <= t; k++)
    {
        int maxi = 0;

        for (int i = 1; i <= n; i++)
        {
            int a, b, c;
            fin >> a >> b >> c;
            v[i] (a, b, c);

            d[i] = 1;

            for (int j = 1; j < i; j++)
                if (v[j] < v[i] && d[j] + 1 > d[i])
                    d[i] = d[j] + 1;

            maxi = max(maxi, d[i]);
        }

        fout << maxi << '\n';
    }

    return 0;
}