結果

問題 No.2601 Very Poor
ユーザー pitPpitP
提出日時 2024-01-12 21:34:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 109,688 KB
最終ジャッジ日時 2024-01-12 21:34:49
合計ジャッジ時間 5,171 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 124 ms
109,560 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 127 ms
109,688 KB
testcase_19 AC 136 ms
109,432 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 130 ms
109,432 KB
testcase_24 AC 126 ms
109,560 KB
testcase_25 AC 127 ms
109,560 KB
testcase_26 AC 134 ms
109,560 KB
testcase_27 AC 160 ms
109,432 KB
testcase_28 AC 130 ms
109,432 KB
testcase_29 AC 131 ms
109,432 KB
testcase_30 AC 126 ms
109,688 KB
testcase_31 AC 138 ms
109,432 KB
testcase_32 AC 127 ms
109,432 KB
testcase_33 AC 132 ms
109,432 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
N, X = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) < X:
    exit(print(sum(A)))
if min(A) > X:
    exit(print(0))

acc = [0] * (2 * N + 1)
for i in range(2 * N):
    acc[i + 1] = acc[i] + A[i % N]

ans = 0
for i in range(N):
    if A[i] > X:
        continue

    ok = i + 1; ng = 2 * N
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if acc[mid] - acc[i] < X:
            ok = mid
        else:
            ng = mid
    ans = max(ans, acc[ok] - acc[i])
print(ans)
0