結果
問題 |
No.8009 異なる数字の最大の範囲(勉強会用)
|
ユーザー |
![]() |
提出日時 | 2015-09-18 02:53:46 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 189 ms / 5,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 24,476 KB |
最終ジャッジ日時 | 2024-11-20 15:00:53 |
合計ジャッジ時間 | 2,777 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
n = int(input()) a = list(map(int,input().split())) num = [False] * 1000001 length = 0 start = 0 best_s = 0 best_l = 0 i = 0 while i < n: if not num[a[i]]: num[a[i]] = True length += 1 i += 1 else: if start >= n: break while start < i and a[start] != a[i]: num[a[start]] = False start += 1 start += 1 length = i - start + 1 i += 1 best_l = max(best_l, length) if best_l == length: best_s = start print(best_l)