結果
| 問題 |
No.3385 Up Down Hiking (C++)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-19 03:47:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 156 ms / 2,000 ms |
| コード長 | 352 bytes |
| コンパイル時間 | 1,710 ms |
| コンパイル使用メモリ | 200,392 KB |
| 実行使用メモリ | 12,276 KB |
| 最終ジャッジ日時 | 2025-11-22 12:34:34 |
| 合計ジャッジ時間 | 7,988 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 43 |
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<bits/stdc++.h>
| ^~~~~~
main.cpp:2:82: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
2 | using namespace std;long n,m,h,i,u,x[1<<17],k;vector<long>G[1<<17],p(1<<18,-1e9);main(){for(;cin>>h;)n?m?i<n?x[i++]=h*n+i:i++-n&1?x[--u]>x[--h]?:u^=h^=u^=h,G[u].push_back(h),0:u=h:m=h:n=h;sort(x,x+n);for(p[i=0]=p[2*n-1]=1;i<2*n;i++)for(int j:G[u=x[i%n]%n])h=i/n*n,k=max(k,p[u+n-h]+(p[u+h]=max(p[u+h],p[j+h]+1)));cout<<k-1<<"\n";}
| ^~~~
ソースコード
#import<bits/stdc++.h>
using namespace std;long n,m,h,i,u,x[1<<17],k;vector<long>G[1<<17],p(1<<18,-1e9);main(){for(;cin>>h;)n?m?i<n?x[i++]=h*n+i:i++-n&1?x[--u]>x[--h]?:u^=h^=u^=h,G[u].push_back(h),0:u=h:m=h:n=h;sort(x,x+n);for(p[i=0]=p[2*n-1]=1;i<2*n;i++)for(int j:G[u=x[i%n]%n])h=i/n*n,k=max(k,p[u+n-h]+(p[u+h]=max(p[u+h],p[j+h]+1)));cout<<k-1<<"\n";}