結果
問題 |
No.1150 シュークリームゲーム(Easy)
|
ユーザー |
|
提出日時 | 2020-08-08 02:09:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 335 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 21,792 KB |
最終ジャッジ日時 | 2024-09-25 04:29:00 |
合計ジャッジ時間 | 5,237 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)%N a,b=t-s-1,N-t-1 ans=2*B[0]-sum(B) u=v=0 while 2*(u+v)<N-2: if 2*(u+1)<=a: ans+=2*B[1+u] u+=1 elif 2*(v+1)<=b: ans+=2*B[N-1-v] v+=1 else: add=[0] if 2*u<a: add.append(B[1+u]) if 2*v<b: add.append(B[N-1-v]) ans+=2*max(add) break print(ans)