結果
問題 |
No.8009 異なる数字の最大の範囲(勉強会用)
|
ユーザー |
|
提出日時 | 2021-09-22 18:24:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 108 ms / 5,000 ms |
コード長 | 291 bytes |
コンパイル時間 | 277 ms |
コンパイル使用メモリ | 82,100 KB |
実行使用メモリ | 102,760 KB |
最終ジャッジ日時 | 2024-11-20 15:08:07 |
合計ジャッジ時間 | 2,556 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
from collections import defaultdict N = int(input()) A = list(map(int, input().split())) ans = 0 counter = defaultdict(int) r = 0 for l in range(N): while r < N and (not counter[A[r]]): counter[A[r]] += 1 r += 1 ans = max(ans, r-l) counter[A[l]] -= 1 print(ans)