結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー mbanmban
提出日時 2017-09-09 17:16:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 5,000 ms
コード長 297 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 98,056 KB
最終ジャッジ日時 2023-08-12 22:42:47
合計ジャッジ時間 3,843 ms
ジャッジサーバーID
(参考情報)
judge7 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
82,632 KB
testcase_01 AC 83 ms
82,956 KB
testcase_02 AC 82 ms
82,636 KB
testcase_03 AC 81 ms
82,956 KB
testcase_04 AC 83 ms
82,640 KB
testcase_05 AC 84 ms
83,164 KB
testcase_06 AC 83 ms
82,600 KB
testcase_07 AC 83 ms
82,828 KB
testcase_08 AC 84 ms
82,748 KB
testcase_09 AC 84 ms
82,968 KB
testcase_10 AC 83 ms
82,784 KB
testcase_11 AC 83 ms
82,960 KB
testcase_12 AC 81 ms
82,636 KB
testcase_13 AC 84 ms
82,680 KB
testcase_14 AC 83 ms
82,748 KB
testcase_15 AC 103 ms
90,988 KB
testcase_16 AC 98 ms
89,784 KB
testcase_17 AC 101 ms
90,820 KB
testcase_18 AC 112 ms
98,056 KB
testcase_19 AC 102 ms
93,136 KB
testcase_20 AC 94 ms
87,332 KB
testcase_21 AC 91 ms
84,140 KB
testcase_22 AC 96 ms
88,088 KB
testcase_23 AC 93 ms
85,396 KB
testcase_24 AC 103 ms
97,984 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