結果
| 問題 |
No.2601 Very Poor
|
| コンテスト | |
| ユーザー |
player
|
| 提出日時 | 2024-01-14 15:10:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 499 bytes |
| コンパイル時間 | 491 ms |
| コンパイル使用メモリ | 82,168 KB |
| 実行使用メモリ | 147,428 KB |
| 最終ジャッジ日時 | 2024-09-28 02:00:33 |
| 合計ジャッジ時間 | 5,254 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 10 TLE * 1 -- * 21 |
ソースコード
from bisect import *
n, x = map(int, input().split())
a = list(map(int, input().split()))
b = a + a
acc = [0]
for i in b:
acc.append(acc[-1] + i)
ans = 0
# print(acc)
for i in range(n):
ind = bisect_left(acc, acc[i] + x)
if ind == len(acc):
num = sum(a)
elif acc[ind] == acc[i + 1] + x:
num = acc[ind] - acc[i]
else:
num = acc[ind - 1] - acc[i]
num = min(sum(a), num)
# print(ind)
# print(num,"ans")
ans = max(ans, num)
print(ans)
player