結果
| 問題 |
No.497 入れ子の箱
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-06 21:21:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,087 bytes |
| コンパイル時間 | 1,283 ms |
| コンパイル使用メモリ | 169,292 KB |
| 実行使用メモリ | 8,960 KB |
| 最終ジャッジ日時 | 2024-11-24 04:09:32 |
| 合計ジャッジ時間 | 13,713 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 5 WA * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 30);
typedef pair<ll,ll> pii;
typedef vector<vector<ll>> Graph;
typedef vector<pii> vpii;
bool contains(vi a,vi b) {
sort(ALL(b));
do {
if(a[0]>b[0]&&a[1]>b[1]&&a[2]>b[2]) return true;
} while(next_permutation(ALL(b)));
return false;
}
int main() {
ll N; cin>>N;
Graph G(N);
{
vvi v(N,vi(3)); REP(i,N) cin>>v[i][0]>>v[i][1]>>v[i][2];
REP(i,N) {
REP(j,N) {
if(contains(v[i],v[j])) {
G[i].PB(j);
}
}
}
}
ll ans=0;
REP(root,N) {
vi cnt(N);
cnt[root]=1;
REP(from,N) {
for(ll to:G[from]) {
cnt[to]=max(cnt[to],cnt[from]+1);
}
}
for(ll i:cnt) ans=max(ans,i);
}
cout<<ans<<endl;
}