結果
問題 | No.8009 異なる数字の最大の範囲(勉強会用) |
ユーザー |
|
提出日時 | 2024-04-20 06:18:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 90 ms / 5,000 ms |
コード長 | 355 bytes |
コンパイル時間 | 420 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 96,512 KB |
最終ジャッジ日時 | 2024-10-12 01:24:45 |
合計ジャッジ時間 | 3,086 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
N = int(input()) A = list(map(int, input().split())) l = 0 r = 0 s = set() mx = 0 while r < N: if A[r] not in s: s.add(A[r]) if len(s) > mx: mx = len(s) r += 1 else: while A[l] != A[r]: # print(l, r, s) s.discard(A[l]) l += 1 l += 1 r += 1 print(mx)