結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー 👑 hitonanodehitonanode
提出日時 2024-04-05 00:31:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 131,372 KB
最終ジャッジ日時 2024-04-05 00:31:26
合計ジャッジ時間 12,708 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,460 KB
testcase_01 AC 41 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 40 ms
53,460 KB
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 44 ms
59,444 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 43 ms
59,460 KB
testcase_09 AC 41 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 40 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 40 ms
53,460 KB
testcase_15 AC 42 ms
53,460 KB
testcase_16 AC 40 ms
53,460 KB
testcase_17 AC 40 ms
53,460 KB
testcase_18 AC 41 ms
53,460 KB
testcase_19 AC 39 ms
53,460 KB
testcase_20 AC 40 ms
53,460 KB
testcase_21 AC 38 ms
53,460 KB
testcase_22 AC 42 ms
53,460 KB
testcase_23 AC 40 ms
53,460 KB
testcase_24 AC 80 ms
89,644 KB
testcase_25 AC 74 ms
85,520 KB
testcase_26 AC 84 ms
92,120 KB
testcase_27 AC 96 ms
98,656 KB
testcase_28 AC 95 ms
98,008 KB
testcase_29 AC 63 ms
78,328 KB
testcase_30 AC 124 ms
102,696 KB
testcase_31 AC 95 ms
98,760 KB
testcase_32 AC 126 ms
103,092 KB
testcase_33 AC 121 ms
103,068 KB
testcase_34 AC 51 ms
66,352 KB
testcase_35 AC 90 ms
97,376 KB
testcase_36 AC 112 ms
98,684 KB
testcase_37 AC 136 ms
107,256 KB
testcase_38 AC 105 ms
97,900 KB
testcase_39 AC 64 ms
75,064 KB
testcase_40 AC 97 ms
98,724 KB
testcase_41 AC 68 ms
81,236 KB
testcase_42 AC 48 ms
62,196 KB
testcase_43 AC 57 ms
70,472 KB
testcase_44 AC 131 ms
106,488 KB
testcase_45 AC 132 ms
106,484 KB
testcase_46 AC 72 ms
87,168 KB
testcase_47 AC 106 ms
89,760 KB
testcase_48 AC 100 ms
98,008 KB
testcase_49 AC 131 ms
113,564 KB
testcase_50 AC 126 ms
113,564 KB
testcase_51 AC 132 ms
113,564 KB
testcase_52 AC 130 ms
113,564 KB
testcase_53 AC 129 ms
113,584 KB
testcase_54 AC 150 ms
130,988 KB
testcase_55 AC 166 ms
131,112 KB
testcase_56 AC 149 ms
131,056 KB
testcase_57 AC 152 ms
131,244 KB
testcase_58 AC 148 ms
130,992 KB
testcase_59 AC 152 ms
130,988 KB
testcase_60 AC 151 ms
131,112 KB
testcase_61 AC 156 ms
131,372 KB
testcase_62 AC 150 ms
130,988 KB
testcase_63 AC 167 ms
131,240 KB
testcase_64 AC 153 ms
131,244 KB
testcase_65 AC 158 ms
131,244 KB
testcase_66 AC 154 ms
131,244 KB
testcase_67 AC 154 ms
130,988 KB
testcase_68 AC 147 ms
131,244 KB
testcase_69 AC 136 ms
126,764 KB
testcase_70 AC 153 ms
126,760 KB
testcase_71 AC 137 ms
126,764 KB
testcase_72 AC 142 ms
126,760 KB
testcase_73 AC 139 ms
126,764 KB
testcase_74 AC 92 ms
102,264 KB
testcase_75 AC 137 ms
126,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, H = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ret = 0

suma = 0
sumb0 = 0
sumb1 = 0

l = 0

for r in range(N):
    # [l, r]
    suma += A[r]

    sumb0 += B[r]
    sumb1 += B[r] * r

    while True:
        # B[l] * 1 + B[l + 1] * 2 + ... + B[r] * (r - l + 1)
        s = sumb1 - sumb0 * (l - 1)
        if s <= H:
            break
        else:
            suma -= A[l]
            sumb0 -= B[l]
            sumb1 -= B[l] * l
            l += 1

    ret = max(ret, suma)

print(ret)
0