結果
問題 | 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 sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n,h = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) r = 0 now = 0 tot = 0 x = 0 ans = 0 for 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 += 1 ans = max(ans, x) now -= tot x -= a[l] tot -= b[l] print(ans)