結果
問題 | No.2694 The Early Bird Catches The Worm |
ユーザー |
|
提出日時 | 2024-03-22 21:54:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 144 ms / 2,000 ms |
コード長 | 582 bytes |
コンパイル時間 | 376 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 132,188 KB |
最終ジャッジ日時 | 2024-09-30 11:23:37 |
合計ジャッジ時間 | 9,377 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 72 |
ソースコード
import syssys.setrecursionlimit(5*10**5)input = sys.stdin.readlinefrom collections import defaultdict, deque, Counterfrom heapq import heappop, heappushfrom bisect import bisect_left, bisect_rightfrom math import gcdn,h = map(int,input().split())a = list(map(int,input().split()))b = list(map(int,input().split()))r = 0now = 0tot = 0x = 0ans = 0for l in range(n):while r < n and now+(r-l+1)*b[r] <=h:now += (r-l+1)*b[r]tot += b[r]x += a[r]r += 1ans = max(ans, x)now -= totx -= a[l]tot -= b[l]print(ans)