結果
問題 |
No.1148 土偶Ⅲ
|
ユーザー |
![]() |
提出日時 | 2023-02-04 14:18:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 225 ms / 2,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 155 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 86,724 KB |
最終ジャッジ日時 | 2024-07-03 11:57:19 |
合計ジャッジ時間 | 4,668 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
from collections import * N, W = map(int, input().split()) Q = deque() D = defaultdict(int) ans = 0 S = 0 for i in range(N): A = int(input()) D[A] += 1 S += A Q.append(A) while D[A] == 2 or S > W: B = Q.popleft() D[B] -= 1 S -= B ans = max(ans, len(Q)) print(ans)