結果

問題 No.497 入れ子の箱
ユーザー kotatsugamekotatsugame
提出日時 2017-03-25 01:10:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 1,760 ms
コンパイル使用メモリ 173,280 KB
実行使用メモリ 6,248 KB
最終ジャッジ日時 2023-09-20 07:26:27
合計ジャッジ時間 3,363 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 9 ms
6,024 KB
testcase_04 AC 10 ms
6,024 KB
testcase_05 AC 10 ms
6,076 KB
testcase_06 AC 9 ms
6,248 KB
testcase_07 AC 9 ms
6,244 KB
testcase_08 AC 10 ms
6,100 KB
testcase_09 AC 9 ms
6,100 KB
testcase_10 AC 10 ms
6,020 KB
testcase_11 AC 9 ms
6,020 KB
testcase_12 AC 11 ms
4,872 KB
testcase_13 AC 11 ms
4,752 KB
testcase_14 AC 11 ms
4,688 KB
testcase_15 AC 11 ms
4,792 KB
testcase_16 AC 11 ms
4,864 KB
testcase_17 AC 11 ms
4,720 KB
testcase_18 AC 9 ms
6,024 KB
testcase_19 AC 9 ms
6,020 KB
testcase_20 AC 9 ms
6,084 KB
testcase_21 AC 9 ms
5,984 KB
testcase_22 AC 9 ms
6,152 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 4 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 11 ms
5,288 KB
testcase_28 AC 11 ms
5,332 KB
testcase_29 AC 11 ms
5,508 KB
testcase_30 AC 8 ms
4,380 KB
testcase_31 AC 8 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:17:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   17 | main()
      | ^~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:22:25: 警告: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
   22 |         for(;i<n;)t[i++]=-1;
      |                   ~~~~~~^~~
main.cpp:11:5: 備考: at offset -4 into destination object ‘t’ of size 4000
   11 | int t[1000],s,i,n,k,x,y,z;
      |     ^

ソースコード

diff #

#include<bits/stdc++.h>
#define m(a,b) a=a<(b)?(b):a
using namespace std;
vector<int>G[1000];
class c
{public:
	int x,y,z;
	void in(int a,int b,int c){int s[3]={a,b,c};sort(s,s+3);x=*s,y=s[1],z=s[2];}
	bool operator<(c a){return a.x>x&&a.y>y&&a.z>z;}
};
int t[1000],s,i,n,k,x,y,z;
int f(int v)
{
	if(t[v]<0){t[v]=0;for(int j=0;j<G[v].size();j++)m(t[v],f(G[v][j])+1);}
	return t[v];
}
main()
{
	c a[1000];
	for(cin>>n;i<n;a[i++].in(x,y,z))cin>>x>>y>>z;
	for(sort(a,a+n);i--;)for(k=n;k--;)if(i-k&&a[k]<a[i])G[i].push_back(k);
	for(;i<n;)t[i++]=-1;
	for(;i--;)m(s,f(i)+1);
	cout<<s<<endl;
}
0