結果

問題 No.497 入れ子の箱
ユーザー rapurasurapurasu
提出日時 2017-04-03 00:23:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 974 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 156,596 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 07:54:40
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 6 ms
4,380 KB
testcase_14 AC 6 ms
4,380 KB
testcase_15 AC 6 ms
4,376 KB
testcase_16 AC 6 ms
4,376 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 AC 4 ms
4,380 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 6 ms
4,376 KB
testcase_28 AC 6 ms
4,376 KB
testcase_29 AC 5 ms
4,376 KB
testcase_30 AC 4 ms
4,376 KB
testcase_31 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
}
0