結果

問題 No.497 入れ子の箱
ユーザー dnishdnish
提出日時 2017-07-01 17:10:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,067 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 176,024 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 07:59:19
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=(int) n;i--)
#define p(s) cout<<(s)<<endl
#define DEBUG(x,y) cout<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl;
#define CK(n,a,b) ((a)<=(n)&&(n)<=(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9;

vector<pair<int,pair<int,int>>> a;

int LIS1(int n){
	pair<int,int> dp[1010];
	REP(i,0,n) dp[i]={inf,inf};
	REP(i,0,n){
		*lower_bound(dp,dp+n,a[i].S)=a[i].S;
	}
	return lower_bound(dp,dp+n,make_pair(inf,inf))-dp;
}

int LIS2(int n){
	int dp[1010];
	REP(i,0,n) dp[i]=inf;
	REP(i,0,n){
		*lower_bound(dp,dp+n,a[i].S.S)=a[i].S.S;
	}
	return lower_bound(dp,dp+n,inf)-dp;
}

int main(){
	int N;
	cin>>N;
	REP(i,0,N){
		int tmp[3];
		cin>>tmp[0]>>tmp[1]>>tmp[2];
		sort(tmp,tmp+3);
		a.push_back({tmp[0],{tmp[1],tmp[2]}});
	}
	sort(a.begin(),a.end());
	//b.push_back({a[0][1],a[0][2]});
	REP(i,1,a.size()){
		if(a[i-1].F==a[i].F) {
			a.erase(a.begin()+i);
			i--;
		}
	}

	int ans=LIS1(a.size());
	p(ans);

	return 0;
}
0