結果
| 問題 | No.1148 土偶Ⅲ |
| ユーザー |
37zigen
|
| 提出日時 | 2020-08-07 20:34:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 400 ms / 2,000 ms |
| コード長 | 289 bytes |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 17,892 KB |
| 最終ジャッジ日時 | 2024-09-24 17:57:22 |
| 合計ジャッジ時間 | 5,541 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
n,w=map(int,input().split())
a=[int(input()) for _ in range(n)]
cnt={}
for v in a:
cnt[v]=0
t=0
ans=0
sw=0
for s in range(n):
while t<n and sw+a[t]<=w and cnt[a[t]]<=0:
sw+=a[t]
cnt[a[t]]+=1
t+=1
ans=max(ans,t-s)
sw-=a[s]
cnt[a[s]]-=1
print(ans)
37zigen