結果
| 問題 |
No.1148 土偶Ⅲ
|
| ユーザー |
titia
|
| 提出日時 | 2023-10-24 05:49:33 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 309 bytes |
| コンパイル時間 | 246 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 14,080 KB |
| 最終ジャッジ日時 | 2024-09-22 22:39:25 |
| 合計ジャッジ時間 | 4,507 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 6 RE * 19 |
ソースコード
n,w=map(int,input().split())
A=[int(input()) for i in range(n)]
Q=set()
S=0
r=0
ANS=0
for i in range(n):
r=max(r,i)
while r<n and not(A[r] in Q) and S+A[r]<=w:
Q.add(A[r])
S+=A[r]
r+=1
ANS=max(ANS,len(Q))
if r>=i:
Q.remove(A[i])
S-=A[i]
print(ANS)
titia