結果
| 問題 |
No.3385 Up Down Hiking (C++)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-21 14:19:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 340 bytes |
| コンパイル時間 | 1,731 ms |
| コンパイル使用メモリ | 197,708 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-11-22 12:37:27 |
| 合計ジャッジ時間 | 7,509 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 42 WA * 1 |
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<bits/stdc++.h>
| ^~~~~~
main.cpp:3:65: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
3 | using namespace std;long n,h[1<<17],G[1<<17],i,u,v,p[1<<18],q,x;main(){for(cin>>n>>u;i<n;i++)cin>>h[i];for(i=0;cin>>u>>v;G[i++]=h[u]*n*n+u*n+v)if(h[--u]>h[--v])swap(u,v);sort(G,G+i);p[0]=p[2*n-1]=n+1;for(i=0;x=G[i++];c(q,c(p[v],p[u]+1)+c(p[v+n],p[u+n]+1)-2*n))u=x/n%n,v=x%n;cout<<q-1<<"\n";}
| ^~~~
ソースコード
#import<bits/stdc++.h>
#define c(a,b)(a=a>b?a:b)
using namespace std;long n,h[1<<17],G[1<<17],i,u,v,p[1<<18],q,x;main(){for(cin>>n>>u;i<n;i++)cin>>h[i];for(i=0;cin>>u>>v;G[i++]=h[u]*n*n+u*n+v)if(h[--u]>h[--v])swap(u,v);sort(G,G+i);p[0]=p[2*n-1]=n+1;for(i=0;x=G[i++];c(q,c(p[v],p[u]+1)+c(p[v+n],p[u+n]+1)-2*n))u=x/n%n,v=x%n;cout<<q-1<<"\n";}