結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー mbanmban
提出日時 2017-09-09 17:16:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 297 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,476 KB
実行使用メモリ 91,300 KB
最終ジャッジ日時 2024-04-30 17:43:52
合計ジャッジ時間 2,595 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
65,892 KB
testcase_01 AC 54 ms
65,764 KB
testcase_02 AC 52 ms
65,912 KB
testcase_03 AC 53 ms
65,880 KB
testcase_04 AC 51 ms
65,204 KB
testcase_05 AC 52 ms
65,332 KB
testcase_06 AC 54 ms
65,752 KB
testcase_07 AC 52 ms
65,076 KB
testcase_08 AC 52 ms
66,016 KB
testcase_09 AC 52 ms
65,400 KB
testcase_10 AC 50 ms
65,724 KB
testcase_11 AC 53 ms
66,044 KB
testcase_12 AC 52 ms
65,664 KB
testcase_13 AC 52 ms
65,332 KB
testcase_14 AC 53 ms
65,224 KB
testcase_15 AC 76 ms
82,168 KB
testcase_16 AC 73 ms
80,264 KB
testcase_17 AC 73 ms
81,996 KB
testcase_18 AC 85 ms
91,300 KB
testcase_19 AC 75 ms
84,292 KB
testcase_20 AC 66 ms
76,368 KB
testcase_21 AC 63 ms
72,776 KB
testcase_22 AC 68 ms
78,176 KB
testcase_23 AC 64 ms
73,636 KB
testcase_24 AC 77 ms
89,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=[False for i in range(1000001)]

right=-1
length=0
anser=-1
for left in range(N):
    if B[A[left]]:
        while B[A[left]]:
            right+=1
            B[A[right]]=False
    
    B[A[left]]=True
    anser=max(anser,left-right)
print(anser)
0