Pagini recente » Cod sursa (job #2272800) | Cod sursa (job #1791826) | Cod sursa (job #164852) | Cod sursa (job #2771145) | Cod sursa (job #2644262)
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define qwerty1 first
#define qwerty2 second
#define qwerty3 -> first
#define qwerty4 -> second
#define umap unordered_map
#define uset unordered_set
#define pii pair < int , int >
#define pq priority_queue
#define dbg(x) cerr << #x << ": " << x << '\n'
using namespace std;
const int N = 3505;
const int M = 1e9 + 7;
const ld PI = acos(-1);
int n , t;
struct chestie
{
int x , y , z;
}a[N];
int d[N];
bool inline cmp(chestie a , chestie b)
{
if(a.x != b.x)
return a.x > b.x;
if(a.y != b.y)
return a.y > b.y;
return a.z > b.z;
}
void Test()
{
int i , j;
for(i = 1 ; i <= n ; i++)
cin >> a[i].x >> a[i].y >> a[i].z;
sort(a + 1 , a + n + 1 , cmp);
int ans = 1;
d[1] = 1;
for(i = 2 ; i <= n ; i++)
for(j = 1 ; j < i ; j++)
if(a[i].x < a[j].x && a[i].y < a[j].y && a[i].z < a[j].z)
d[i] = d[j] + 1 , ans = max(ans , d[i]);
cout << ans << '\n';
}
signed main()
{
#ifndef ONLINE_JUDGE
freopen("cutii.in" , "r" , stdin) , freopen("cutii.out" , "w" , stdout);
#endif
ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
cin >> n >> t;
while(t--)
Test();
return 0;
}