結果
問題 | No.497 入れ子の箱 |
ユーザー |
|
提出日時 | 2017-03-31 05:19:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 1,959 ms |
コンパイル使用メモリ | 180,096 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-07 03:53:55 |
合計ジャッジ時間 | 3,201 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)#define all(x) (x).begin(),(x).end()#define pb push_back#define fi first#define se secondtypedef vector<int> vi;int main(){int n;cin >>n;vector<vi> b(n);rep(i,n){vi v(3);rep(j,3) cin >>v[j];sort(all(v));b[i] = v;}sort(all(b));vi dp(n,1);rep(i,n)rep(j,i){bool ok = true;rep(k,3) ok &= (b[i][k]>b[j][k]);if(ok) dp[i] = max(dp[i],dp[j]+1);}int ans = 1;rep(i,n) ans = max(ans,dp[i]);cout << ans << endl;return 0;}