結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー ra5anchorra5anchor
提出日時 2024-04-20 06:18:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 355 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 97,280 KB
最終ジャッジ日時 2024-04-20 06:18:29
合計ジャッジ時間 1,950 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
52,572 KB
testcase_01 AC 30 ms
53,072 KB
testcase_02 AC 34 ms
52,604 KB
testcase_03 AC 33 ms
51,816 KB
testcase_04 AC 33 ms
52,328 KB
testcase_05 AC 33 ms
52,840 KB
testcase_06 AC 33 ms
52,408 KB
testcase_07 AC 32 ms
52,032 KB
testcase_08 AC 30 ms
53,296 KB
testcase_09 AC 34 ms
53,184 KB
testcase_10 AC 32 ms
52,016 KB
testcase_11 AC 31 ms
53,216 KB
testcase_12 AC 30 ms
52,996 KB
testcase_13 AC 30 ms
52,504 KB
testcase_14 AC 31 ms
52,560 KB
testcase_15 AC 54 ms
78,948 KB
testcase_16 AC 52 ms
76,376 KB
testcase_17 AC 55 ms
79,336 KB
testcase_18 AC 67 ms
89,528 KB
testcase_19 AC 57 ms
82,016 KB
testcase_20 AC 48 ms
71,440 KB
testcase_21 AC 43 ms
66,804 KB
testcase_22 AC 49 ms
73,496 KB
testcase_23 AC 44 ms
67,984 KB
testcase_24 AC 74 ms
97,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0