結果
問題 | No.2694 The Early Bird Catches The Worm |
ユーザー | Theta |
提出日時 | 2024-04-24 13:31:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 184 ms / 2,000 ms |
コード長 | 1,115 bytes |
コンパイル時間 | 404 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 154,336 KB |
最終ジャッジ日時 | 2024-11-06 21:42:37 |
合計ジャッジ時間 | 13,948 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
51,968 KB |
testcase_01 | AC | 41 ms
52,224 KB |
testcase_02 | AC | 41 ms
52,096 KB |
testcase_03 | AC | 41 ms
51,840 KB |
testcase_04 | AC | 40 ms
52,480 KB |
testcase_05 | AC | 40 ms
52,224 KB |
testcase_06 | AC | 49 ms
59,776 KB |
testcase_07 | AC | 42 ms
52,480 KB |
testcase_08 | AC | 46 ms
58,880 KB |
testcase_09 | AC | 42 ms
52,864 KB |
testcase_10 | AC | 42 ms
52,352 KB |
testcase_11 | AC | 41 ms
52,992 KB |
testcase_12 | AC | 42 ms
52,352 KB |
testcase_13 | AC | 41 ms
52,096 KB |
testcase_14 | AC | 41 ms
52,736 KB |
testcase_15 | AC | 42 ms
52,352 KB |
testcase_16 | AC | 42 ms
52,608 KB |
testcase_17 | AC | 42 ms
52,736 KB |
testcase_18 | AC | 42 ms
52,736 KB |
testcase_19 | AC | 40 ms
52,096 KB |
testcase_20 | AC | 42 ms
52,864 KB |
testcase_21 | AC | 41 ms
52,224 KB |
testcase_22 | AC | 43 ms
52,608 KB |
testcase_23 | AC | 42 ms
52,736 KB |
testcase_24 | AC | 89 ms
93,568 KB |
testcase_25 | AC | 87 ms
92,544 KB |
testcase_26 | AC | 92 ms
95,360 KB |
testcase_27 | AC | 109 ms
98,944 KB |
testcase_28 | AC | 113 ms
101,336 KB |
testcase_29 | AC | 73 ms
81,280 KB |
testcase_30 | AC | 150 ms
124,388 KB |
testcase_31 | AC | 112 ms
98,944 KB |
testcase_32 | AC | 151 ms
124,664 KB |
testcase_33 | AC | 151 ms
124,384 KB |
testcase_34 | AC | 59 ms
66,688 KB |
testcase_35 | AC | 101 ms
97,792 KB |
testcase_36 | AC | 120 ms
105,164 KB |
testcase_37 | AC | 164 ms
131,136 KB |
testcase_38 | AC | 130 ms
110,676 KB |
testcase_39 | AC | 72 ms
79,488 KB |
testcase_40 | AC | 108 ms
98,816 KB |
testcase_41 | AC | 83 ms
87,552 KB |
testcase_42 | AC | 50 ms
61,440 KB |
testcase_43 | AC | 64 ms
70,656 KB |
testcase_44 | AC | 166 ms
130,484 KB |
testcase_45 | AC | 156 ms
130,348 KB |
testcase_46 | AC | 91 ms
94,720 KB |
testcase_47 | AC | 88 ms
92,416 KB |
testcase_48 | AC | 113 ms
101,212 KB |
testcase_49 | AC | 156 ms
130,096 KB |
testcase_50 | AC | 155 ms
130,472 KB |
testcase_51 | AC | 154 ms
130,092 KB |
testcase_52 | AC | 155 ms
130,100 KB |
testcase_53 | AC | 159 ms
130,136 KB |
testcase_54 | AC | 177 ms
145,900 KB |
testcase_55 | AC | 179 ms
145,892 KB |
testcase_56 | AC | 180 ms
146,412 KB |
testcase_57 | AC | 181 ms
145,764 KB |
testcase_58 | AC | 179 ms
145,768 KB |
testcase_59 | AC | 181 ms
146,272 KB |
testcase_60 | AC | 184 ms
145,768 KB |
testcase_61 | AC | 176 ms
146,032 KB |
testcase_62 | AC | 178 ms
146,148 KB |
testcase_63 | AC | 177 ms
146,400 KB |
testcase_64 | AC | 173 ms
145,900 KB |
testcase_65 | AC | 177 ms
146,016 KB |
testcase_66 | AC | 176 ms
145,684 KB |
testcase_67 | AC | 174 ms
146,024 KB |
testcase_68 | AC | 174 ms
146,028 KB |
testcase_69 | AC | 175 ms
153,836 KB |
testcase_70 | AC | 173 ms
153,828 KB |
testcase_71 | AC | 174 ms
153,796 KB |
testcase_72 | AC | 172 ms
154,336 KB |
testcase_73 | AC | 172 ms
153,964 KB |
testcase_74 | AC | 104 ms
102,528 KB |
testcase_75 | AC | 171 ms
153,960 KB |
ソースコード
from itertools import accumulate import sys def printe(*args, end="\n", **kwargs): print(*args, end=end, file=sys.stderr, **kwargs) def main(): N, H = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_accum = list(accumulate(A)) B_accum = list(accumulate(B, initial=0)) max_satisfied = 0 L = 0 R = 0 cur_tired = 0 cur_satisfied = 0 while L < N: if R == N: max_satisfied = max(max_satisfied, cur_satisfied) break if cur_tired + B[R] * (R - L + 1) <= H: cur_tired += B[R] * (R - L + 1) cur_satisfied += A[R] R += 1 continue max_satisfied = max(max_satisfied, cur_satisfied) if L < R: cur_satisfied -= A[L] cur_tired -= B_accum[R] - B_accum[L] L += 1 else: L += 1 R += 1 # cur_satisfied += A[R] # cur_tired += B[R] * (R - L) # R += 1 # L += 1 print(max_satisfied) if __name__ == "__main__": main()