結果
問題 |
No.1150 シュークリームゲーム(Easy)
|
ユーザー |
![]() |
提出日時 | 2020-08-07 23:37:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 643 ms |
コンパイル使用メモリ | 82,044 KB |
実行使用メモリ | 97,024 KB |
最終ジャッジ日時 | 2024-09-25 01:02:26 |
合計ジャッジ時間 | 4,862 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 34 |
ソースコード
n = int(input()) s, t = map(int, input().split()) s, t = s-1, t-1 a = list(map(int, input().split())) cum = [0] for x in a: cum.append(cum[-1] + x) S = cum[-1] ans = -10**20 for l in range(n): r = l + (n-1)//2 #print(l, r) if not (l <= s <= r or s <= r%n <= l): continue if (l <= t <= r or t <= r%n <= l): continue #print(l, r) if r < n: ans = max(ans, 2 * cum[r+1] - 2 * cum[l] - S) else: r %= n ans = max(ans, S - 2 * cum[l] + 2 * cum[r+1]) print(ans)