結果
問題 | No.1150 シュークリームゲーム(Easy) |
ユーザー |
|
提出日時 | 2020-08-08 02:05:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 491 bytes |
コンパイル時間 | 273 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,796 KB |
最終ジャッジ日時 | 2024-09-25 04:20:17 |
合計ジャッジ時間 | 4,942 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 43 |
ソースコード
N=int(input())s,t=map(int,input().split())A=[int(x) for x in input().split()]B=[A[(i+s-1)%N] for i in range(N)]s,t=0,(t-s)%Na,b=t-s-1,N-t-1ans=2*B[0]-sum(B)u,v=0,0while 2*(u+v)<N-2:if 2*(u+1)<=a:ans+=2*B[1+u]u+=1elif 2*(v+1)<=b:ans+=2*B[N-1-v]v+=1else:add=0if 2*u<a:add=max(add,B[1+u])u+=1if 2*v<b:add=max(add,B[N-1-v])v+=1ans+=2*addprint(ans)