結果
問題 | No.2694 The Early Bird Catches The Worm |
ユーザー | MM |
提出日時 | 2024-02-15 20:41:08 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 541 ms / 2,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 130 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 41,332 KB |
最終ジャッジ日時 | 2024-09-28 22:30:50 |
合計ジャッジ時間 | 21,037 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
10,752 KB |
testcase_01 | AC | 28 ms
10,880 KB |
testcase_02 | AC | 27 ms
10,880 KB |
testcase_03 | AC | 27 ms
10,752 KB |
testcase_04 | AC | 25 ms
10,752 KB |
testcase_05 | AC | 25 ms
10,752 KB |
testcase_06 | AC | 26 ms
11,008 KB |
testcase_07 | AC | 25 ms
10,880 KB |
testcase_08 | AC | 25 ms
10,880 KB |
testcase_09 | AC | 26 ms
10,752 KB |
testcase_10 | AC | 26 ms
10,880 KB |
testcase_11 | AC | 25 ms
10,752 KB |
testcase_12 | AC | 25 ms
10,752 KB |
testcase_13 | AC | 25 ms
10,880 KB |
testcase_14 | AC | 25 ms
10,880 KB |
testcase_15 | AC | 25 ms
10,880 KB |
testcase_16 | AC | 25 ms
10,880 KB |
testcase_17 | AC | 29 ms
10,880 KB |
testcase_18 | AC | 26 ms
10,752 KB |
testcase_19 | AC | 24 ms
10,880 KB |
testcase_20 | AC | 25 ms
10,880 KB |
testcase_21 | AC | 24 ms
10,752 KB |
testcase_22 | AC | 25 ms
10,752 KB |
testcase_23 | AC | 25 ms
10,752 KB |
testcase_24 | AC | 154 ms
18,888 KB |
testcase_25 | AC | 116 ms
18,196 KB |
testcase_26 | AC | 170 ms
19,900 KB |
testcase_27 | AC | 229 ms
23,616 KB |
testcase_28 | AC | 196 ms
25,300 KB |
testcase_29 | AC | 74 ms
15,748 KB |
testcase_30 | AC | 308 ms
34,332 KB |
testcase_31 | AC | 192 ms
23,792 KB |
testcase_32 | AC | 417 ms
35,344 KB |
testcase_33 | AC | 409 ms
34,552 KB |
testcase_34 | AC | 39 ms
12,032 KB |
testcase_35 | AC | 184 ms
22,668 KB |
testcase_36 | AC | 263 ms
26,468 KB |
testcase_37 | AC | 436 ms
38,004 KB |
testcase_38 | AC | 239 ms
29,960 KB |
testcase_39 | AC | 68 ms
15,020 KB |
testcase_40 | AC | 189 ms
23,788 KB |
testcase_41 | AC | 106 ms
16,944 KB |
testcase_42 | AC | 34 ms
11,392 KB |
testcase_43 | AC | 52 ms
12,928 KB |
testcase_44 | AC | 361 ms
37,848 KB |
testcase_45 | AC | 325 ms
37,848 KB |
testcase_46 | AC | 138 ms
19,312 KB |
testcase_47 | AC | 119 ms
19,200 KB |
testcase_48 | AC | 263 ms
25,296 KB |
testcase_49 | AC | 514 ms
22,184 KB |
testcase_50 | AC | 533 ms
23,248 KB |
testcase_51 | AC | 502 ms
22,180 KB |
testcase_52 | AC | 503 ms
22,220 KB |
testcase_53 | AC | 502 ms
22,164 KB |
testcase_54 | AC | 438 ms
41,280 KB |
testcase_55 | AC | 451 ms
41,204 KB |
testcase_56 | AC | 428 ms
41,276 KB |
testcase_57 | AC | 513 ms
41,200 KB |
testcase_58 | AC | 407 ms
41,200 KB |
testcase_59 | AC | 489 ms
41,196 KB |
testcase_60 | AC | 494 ms
41,212 KB |
testcase_61 | AC | 495 ms
41,332 KB |
testcase_62 | AC | 541 ms
41,204 KB |
testcase_63 | AC | 491 ms
41,288 KB |
testcase_64 | AC | 367 ms
41,080 KB |
testcase_65 | AC | 459 ms
41,200 KB |
testcase_66 | AC | 469 ms
41,200 KB |
testcase_67 | AC | 381 ms
41,200 KB |
testcase_68 | AC | 361 ms
41,200 KB |
testcase_69 | AC | 509 ms
33,084 KB |
testcase_70 | AC | 538 ms
32,964 KB |
testcase_71 | AC | 533 ms
32,964 KB |
testcase_72 | AC | 518 ms
33,088 KB |
testcase_73 | AC | 532 ms
33,088 KB |
testcase_74 | AC | 261 ms
21,872 KB |
testcase_75 | AC | 505 ms
33,092 KB |
ソースコード
N, H = map(int, input().split()) # Reading N and H A = list(map(int, input().split())) B = list(map(int, input().split())) # Prepare cumulative sum of B S = [0] * (N + 1) for i in range(N): S[i + 1] = S[i] + B[i] # Solve using sliding window method ans = 0 tmp = 0 need_hp = 0 r = 0 for l in range(N): while r < N and need_hp + B[r] * (r - l + 1) <= H: tmp += A[r] need_hp += B[r] * (r - l + 1) r += 1 # Debugging output (optional) # print(l, r, need_hp, tmp) # Changing Maximum ans = max(ans, tmp) # Preparing for incrementing l if l == r: r += 1 else: tmp -= A[l] need_hp -= S[r] - S[l] # Cumulative sum for O(1) update # Output print(ans)