結果
| 問題 |
No.497 入れ子の箱
|
| コンテスト | |
| ユーザー |
rapurasu
|
| 提出日時 | 2017-04-03 00:23:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 974 bytes |
| コンパイル時間 | 1,374 ms |
| コンパイル使用メモリ | 169,736 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 00:22:07 |
| 合計ジャッジ時間 | 2,572 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
//typedef __int128 LL;
int N;
LL X[1001];
LL Y[1001];
LL Z[1001];
typedef pair<LL,int> P;
vector<P>v;
int dp[1001];
int main(){
cin>>N;
REP(i,N){
cin>>X[i]>>Y[i]>>Z[i];
vector<LL>a;
a.push_back(X[i]);
a.push_back(Y[i]);
a.push_back(Z[i]);
sort(a.begin(),a.end());
X[i]=a[0];
Y[i]=a[1];
Z[i]=a[2];
v.push_back(P(Z[i],i));
}
sort(v.begin(),v.end());
REP(i,1001){
dp[i]=1;
}
REP(i,N){
for(int j=i+1;j<N;j++){
int a=v[i].second;
int b=v[j].second;
if(X[a]<X[b]&&Y[a]<Y[b]&&Z[a]<Z[b]){
dp[j]=max(dp[j],dp[i]+1);
}
}
}
int ans=0;
REP(i,1001){
ans=max(ans,dp[i]);
}
cout<<ans<<endl;
return(0);
}
rapurasu