結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー y61mpnly61mpnl
提出日時 2020-10-21 13:32:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 208 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 20,960 KB
最終ジャッジ日時 2023-08-12 22:44:03
合計ジャッジ時間 2,244 ms
ジャッジサーバーID
(参考情報)
judge10 / judge7
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 16 ms
7,916 KB
testcase_02 AC 17 ms
7,800 KB
testcase_03 AC 16 ms
7,944 KB
testcase_04 AC 16 ms
7,848 KB
testcase_05 AC 16 ms
7,900 KB
testcase_06 AC 15 ms
7,856 KB
testcase_07 AC 16 ms
7,892 KB
testcase_08 AC 15 ms
7,780 KB
testcase_09 AC 15 ms
7,884 KB
testcase_10 AC 16 ms
7,840 KB
testcase_11 AC 15 ms
7,844 KB
testcase_12 AC 16 ms
7,804 KB
testcase_13 AC 16 ms
7,820 KB
testcase_14 AC 15 ms
7,844 KB
testcase_15 AC 85 ms
14,068 KB
testcase_16 AC 78 ms
13,708 KB
testcase_17 AC 85 ms
14,176 KB
testcase_18 AC 136 ms
19,300 KB
testcase_19 AC 98 ms
14,944 KB
testcase_20 AC 55 ms
11,648 KB
testcase_21 AC 35 ms
9,864 KB
testcase_22 AC 62 ms
12,504 KB
testcase_23 AC 42 ms
10,504 KB
testcase_24 AC 147 ms
20,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, *a = map(int, open(0).read().split())
ans = r = 0
st = set()
for l in range(n):
    while r<n and not(a[r] in st):
        st.add(a[r])
        r += 1
    ans = max(ans, r-l)
    st.remove(a[l])
print(ans)
0