結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー zaki_chemtechzaki_chemtech
提出日時 2020-07-10 10:11:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 322 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 104,616 KB
最終ジャッジ日時 2023-08-12 22:43:27
合計ジャッジ時間 3,772 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,316 KB
testcase_01 AC 73 ms
71,184 KB
testcase_02 AC 73 ms
71,268 KB
testcase_03 AC 74 ms
71,272 KB
testcase_04 AC 71 ms
71,132 KB
testcase_05 AC 72 ms
71,144 KB
testcase_06 AC 69 ms
71,084 KB
testcase_07 AC 72 ms
71,336 KB
testcase_08 AC 69 ms
71,308 KB
testcase_09 AC 69 ms
71,352 KB
testcase_10 AC 70 ms
71,140 KB
testcase_11 AC 72 ms
71,248 KB
testcase_12 AC 71 ms
70,952 KB
testcase_13 AC 72 ms
71,140 KB
testcase_14 AC 70 ms
71,136 KB
testcase_15 AC 99 ms
91,076 KB
testcase_16 AC 94 ms
89,204 KB
testcase_17 AC 98 ms
91,028 KB
testcase_18 AC 115 ms
104,616 KB
testcase_19 AC 101 ms
94,644 KB
testcase_20 AC 91 ms
83,464 KB
testcase_21 AC 82 ms
77,068 KB
testcase_22 AC 95 ms
84,880 KB
testcase_23 AC 81 ms
79,608 KB
testcase_24 AC 108 ms
104,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

a = list(map(int,input().split()))

head = 0

check = {a[0]:0}

ans = 0

for tail in range(1,n):
    if a[tail] in check and head <= check[a[tail]]:
        ans = max(ans, tail-head)
        head = check[a[tail]]+1    

    check[a[tail]] = tail
    #print(ans,tail,head)
ans = max(ans, n-head)

print(ans)
0