結果

問題 No.3385 Up Down Hiking (C++)
コンテスト
ユーザー alcea
提出日時 2025-11-21 14:25:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 338 bytes
コンパイル時間 1,743 ms
コンパイル使用メモリ 196,028 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-22 12:37:28
合計ジャッジ時間 7,871 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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:47: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | long n,m,h[1<<17],G[1<<17],i,u,v,p[1<<18],q,x;main(){for(;std::cin>>v;)n?m?i<n?h[i++]=v:i++-n&1?h[--u]<h[--v]?:u^=v^=u^=v,G[i+~n>>1]=h[u]*n*n+u*n+v:u=v:m=v:n=v;std::sort(G,G+m);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;printf("%d\n",q-1);}
      |                                               ^~~~
main.cpp: In function ‘int main()’:
main.cpp:3:279: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
    3 | long n,m,h[1<<17],G[1<<17],i,u,v,p[1<<18],q,x;main(){for(;std::cin>>v;)n?m?i<n?h[i++]=v:i++-n&1?h[--u]<h[--v]?:u^=v^=u^=v,G[i+~n>>1]=h[u]*n*n+u*n+v:u=v:m=v:n=v;std::sort(G,G+m);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;printf("%d\n",q-1);}
      |                                                                                                                                                                                                                                                                                      ~^    ~~~
      |                                                                                                                                                                                                                                                                                       |     |
      |                                                                                                                                                                                                                                                                                       int   long int
      |                                                              

ソースコード

diff #
raw source code

#import<bits/stdc++.h>
#define c(a,b)(a=a>b?a:b)
long n,m,h[1<<17],G[1<<17],i,u,v,p[1<<18],q,x;main(){for(;std::cin>>v;)n?m?i<n?h[i++]=v:i++-n&1?h[--u]<h[--v]?:u^=v^=u^=v,G[i+~n>>1]=h[u]*n*n+u*n+v:u=v:m=v:n=v;std::sort(G,G+m);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;printf("%d\n",q-1);}
0