結果
| 問題 | No.497 入れ子の箱 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-25 01:10:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 5,000 ms |
| コード長 | 587 bytes |
| 記録 | |
| コンパイル時間 | 1,501 ms |
| コンパイル使用メモリ | 174,028 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-07-06 03:22:39 |
| 合計ジャッジ時間 | 2,492 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
17 | main()
| ^~~~
main.cpp: In function 'int main()':
main.cpp:22:25: warning: '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: note: at offset -4 into destination object 't' of size 4000
11 | int t[1000],s,i,n,k,x,y,z;
| ^
ソースコード
#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;
}