結果

問題 No.3385 Up Down Hiking (C++)
コンテスト
ユーザー alcea
提出日時 2025-11-21 16:48:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 196,044 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-22 12:37:49
合計ジャッジ時間 7,773 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 29 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<bits/stdc++.h>
      |  ^~~~~~
main.cpp:3:45: 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;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]=h[u]*n*n+u*n+v:u=v:m=v:n=v+1;std::sort(G,G+2*m);p[1]=p[2*n-1]=n;for(i=m;m=G[i++];)c(q,c(p[v=m%n],p[u=m/n%n]+1)+c(p[v+n],p[u+n]+1)-2*n+2);printf("%d\n",q-1);}
      |                                             ^~~~
main.cpp: In function ‘int main()’:
main.cpp:3:268: 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;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]=h[u]*n*n+u*n+v:u=v:m=v:n=v+1;std::sort(G,G+2*m);p[1]=p[2*n-1]=n;for(i=m;m=G[i++];)c(q,c(p[v=m%n],p[u=m/n%n]+1)+c(p[v+n],p[u+n]+1)-2*n+2);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;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]=h[u]*n*n+u*n+v:u=v:m=v:n=v+1;std::sort(G,G+2*m);p[1]=p[2*n-1]=n;for(i=m;m=G[i++];)c(q,c(p[v=m%n],p[u=m/n%n]+1)+c(p[v+n],p[u+n]+1)-2*n+2);printf("%d\n",q-1);}
0