結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー 👑 timitimi
提出日時 2024-03-02 15:45:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 157,544 KB
最終ジャッジ日時 2024-03-02 15:45:41
合計ジャッジ時間 14,594 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
55,596 KB
testcase_01 AC 40 ms
55,596 KB
testcase_02 AC 38 ms
55,596 KB
testcase_03 AC 38 ms
55,596 KB
testcase_04 AC 45 ms
55,596 KB
testcase_05 AC 41 ms
55,596 KB
testcase_06 AC 44 ms
61,596 KB
testcase_07 AC 40 ms
55,596 KB
testcase_08 AC 42 ms
61,596 KB
testcase_09 AC 40 ms
55,596 KB
testcase_10 AC 44 ms
55,596 KB
testcase_11 AC 39 ms
55,596 KB
testcase_12 AC 39 ms
55,596 KB
testcase_13 AC 39 ms
55,596 KB
testcase_14 AC 40 ms
55,596 KB
testcase_15 AC 41 ms
55,596 KB
testcase_16 AC 39 ms
55,596 KB
testcase_17 AC 41 ms
55,596 KB
testcase_18 AC 64 ms
55,596 KB
testcase_19 AC 39 ms
55,596 KB
testcase_20 AC 40 ms
55,596 KB
testcase_21 AC 39 ms
55,596 KB
testcase_22 AC 42 ms
55,596 KB
testcase_23 AC 39 ms
55,596 KB
testcase_24 AC 94 ms
91,708 KB
testcase_25 AC 86 ms
89,360 KB
testcase_26 AC 86 ms
91,092 KB
testcase_27 AC 102 ms
98,880 KB
testcase_28 AC 112 ms
103,108 KB
testcase_29 AC 75 ms
83,732 KB
testcase_30 AC 143 ms
123,084 KB
testcase_31 AC 106 ms
99,072 KB
testcase_32 AC 138 ms
123,324 KB
testcase_33 AC 156 ms
123,688 KB
testcase_34 AC 60 ms
72,868 KB
testcase_35 AC 99 ms
95,784 KB
testcase_36 AC 109 ms
105,128 KB
testcase_37 AC 158 ms
147,960 KB
testcase_38 AC 121 ms
109,868 KB
testcase_39 AC 74 ms
82,128 KB
testcase_40 AC 97 ms
99,028 KB
testcase_41 AC 77 ms
87,540 KB
testcase_42 AC 55 ms
66,644 KB
testcase_43 AC 56 ms
72,904 KB
testcase_44 AC 160 ms
148,216 KB
testcase_45 AC 165 ms
148,212 KB
testcase_46 AC 82 ms
91,200 KB
testcase_47 AC 87 ms
91,948 KB
testcase_48 AC 106 ms
103,232 KB
testcase_49 AC 153 ms
133,420 KB
testcase_50 AC 155 ms
132,900 KB
testcase_51 AC 163 ms
133,416 KB
testcase_52 AC 155 ms
133,420 KB
testcase_53 AC 182 ms
133,460 KB
testcase_54 AC 173 ms
157,540 KB
testcase_55 AC 173 ms
157,544 KB
testcase_56 AC 171 ms
157,544 KB
testcase_57 AC 169 ms
157,536 KB
testcase_58 AC 172 ms
157,540 KB
testcase_59 AC 170 ms
157,544 KB
testcase_60 AC 171 ms
157,544 KB
testcase_61 AC 191 ms
157,544 KB
testcase_62 AC 173 ms
157,544 KB
testcase_63 AC 167 ms
157,416 KB
testcase_64 AC 169 ms
157,520 KB
testcase_65 AC 170 ms
157,536 KB
testcase_66 AC 173 ms
157,544 KB
testcase_67 AC 189 ms
157,544 KB
testcase_68 AC 170 ms
157,520 KB
testcase_69 AC 155 ms
154,468 KB
testcase_70 AC 176 ms
154,464 KB
testcase_71 AC 155 ms
154,476 KB
testcase_72 AC 156 ms
154,468 KB
testcase_73 AC 157 ms
154,468 KB
testcase_74 AC 103 ms
99,720 KB
testcase_75 AC 155 ms
154,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque  
mod=998244353
from sys import stdin, setrecursionlimit
input = stdin.readline
readline = stdin.readline
import math
N,H=map(int, stdin.readline().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
AA=[0]
for a in A:
  AA.append(AA[-1]+a)
BB=[0]
for b in B:
  BB.append(BB[-1]+b)
# print(AA)
# print(BB)

if min(B)>H:
  print(0)
  exit()

ans=0;c=0;r=-1
for l in range(N):
  while r+1<N and c+(r+1-l+1)*B[r+1]<=H:
    c+=(r+1-l+1)*B[r+1]
    r+=1 
  ans=max(ans,AA[r+1]-AA[l])
  c-=BB[r+1]-BB[l]
print(ans)
0