結果
問題 | No.497 入れ子の箱 |
ユーザー |
|
提出日時 | 2020-07-25 13:42:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 5,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 2,476 ms |
コンパイル使用メモリ | 206,580 KB |
最終ジャッジ日時 | 2025-01-12 05:25:12 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; cin>>n; vector a(n,vector(3,0)); rep(i,n){ rep(j,3) cin>>a[i][j]; sort(a[i].begin(),a[i].end()); } sort(a.begin(),a.end()); vector<int> dp(n,1); rep(i,n) rep(j,i) if(a[j][0]<a[i][0] && a[j][1]<a[i][1] && a[j][2]<a[i][2]) { dp[i]=max(dp[i],dp[j]+1); } printf("%d\n",*max_element(dp.begin(),dp.end())); return 0; }