結果
問題 | No.1148 土偶Ⅲ |
ユーザー |
|
提出日時 | 2020-08-05 23:10:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 346 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 103 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 18,016 KB |
最終ジャッジ日時 | 2024-09-17 20:25:08 |
合計ジャッジ時間 | 5,456 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#!/usr/bin/env python3# †from collections import Counter, deque###if __name__ == '__main__':N, W = map(int, input().split())a = [int(input()) for _ in range(N)]deq = deque()acc = 0cnt = Counter()maxi = 0size = 0for ai in a:deq.append(ai)acc += aicnt[ai] += 1size += 1while cnt[ai] > 1 or W < acc:top = deq.popleft()cnt[top] -= 1acc -= topsize -= 1maxi = max(maxi, size)print(maxi)