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