結果
| 問題 |
No.3385 Up Down Hiking (C++)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-21 13:13:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 1,546 ms |
| コンパイル使用メモリ | 197,920 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-22 12:37:18 |
| 合計ジャッジ時間 | 7,459 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:4:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
4 | main(){
| ^~~~
ソースコード
#import<bits/stdc++.h>
using namespace std;
long n,m,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++];q=max(q,(p[v]=max(p[v],p[u]+1))+(p[v+n]=max(p[v+n],p[u+n]+1))-2*n))
u=x/n%n,v=x%n;
cout<<q-1<<"\n";
}