結果
問題 |
No.1148 土偶Ⅲ
|
ユーザー |
![]() |
提出日時 | 2020-08-05 20:27:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 308 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 17,888 KB |
最終ジャッジ日時 | 2024-09-17 10:55:49 |
合計ジャッジ時間 | 5,200 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 18 |
ソースコード
N, W = map(int, input().split()) A = [ int(input()) for i in range(N) ] cnts = {} for i in range(N): cnts[A[i]] = 0 R = 0 S = 0 ans = 0 for i in range(N): while R < N and S + A[R] <= W and cnts[A[R]] == 0: cnts[A[R]] += 1 S += A[R] R += 1 ans = max(ans, R - i) cnts[A[i]] -= 1 S -= A[i] print(ans)