結果
| 問題 |
No.1150 シュークリームゲーム(Easy)
|
| コンテスト | |
| ユーザー |
Chihaya_chan
|
| 提出日時 | 2020-09-05 00:56:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 754 bytes |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 23,808 KB |
| 最終ジャッジ日時 | 2024-11-26 21:22:45 |
| 合計ジャッジ時間 | 4,970 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 40 |
ソースコード
def main():
N = int(input())
s, t = map(int, input().split())
A = list(map(int, input().split()))
R = A[s:t-1]
L = A[t:] + A[:s-1]
len_R = len(R)
len_L = len(L)
K = (N-1)//2
ans = A[s-1]
Sum_A = sum(A)
R.insert(0, 0)
L.insert(0, 0)
for i in range(1, len_R+1):
R[i] += R[i-1]
for i in range(1, len_L+1):
L[i] += L[i-1]
for i in range(len_R+1):
if 0 <= K-i <= len_L:
try_max = L[K-i] + R[i] + A[s-1]
if try_max > ans:
if (len_R - i == 0 or len_R-i >= N//2 - 1) and (len_L == K-i or len_L-(K-i) >= N//2 - 1):
ans = try_max
ans = 2*ans - Sum_A
print(ans)
return
if __name__ == "__main__":
main()
Chihaya_chan