結果
| 問題 | No.8009 異なる数字の最大の範囲(勉強会用) |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-01-10 23:46:06 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 106 ms / 5,000 ms |
| + 289µs | |
| コード長 | 571 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 14,848 KB |
| 実行使用メモリ | 24,996 KB |
| 最終ジャッジ日時 | 2026-09-27 02:01:00 |
| 合計ジャッジ時間 | 2,411 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
n=int(input())
ns=list(map(int,input().split()))
dic={}
s=set()
cnt=0
ans=0
r=0
for i in range(n):
if ns[i] not in dic:
dic[ns[i]] = 1
cnt += 1
ans=max(ans,cnt)
else:
dic[ns[i]] += 1
s.add(ns[i])
while s:
if ns[r] in s:
dic[ns[r]] -= 1
s=set()
r+=1
else:
dic[ns[r]] -= 1
if dic[ns[r]] == 0:
del dic[ns[r]]
r+=1
cnt = (i+1) - r
print(ans)
lllllll88938494