結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー zutsuzutsu
提出日時 2022-05-15 21:35:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 943 ms
コンパイル使用メモリ 10,528 KB
実行使用メモリ 28,364 KB
最終ジャッジ日時 2023-09-03 17:03:03
合計ジャッジ時間 15,261 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
28,364 KB
testcase_01 AC 18 ms
8,608 KB
testcase_02 AC 18 ms
8,432 KB
testcase_03 WA -
testcase_04 AC 19 ms
8,620 KB
testcase_05 AC 18 ms
8,524 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 19 ms
8,588 KB
testcase_09 AC 19 ms
8,432 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 18 ms
8,552 KB
testcase_13 WA -
testcase_14 AC 18 ms
8,436 KB
testcase_15 AC 971 ms
14,916 KB
testcase_16 AC 820 ms
14,224 KB
testcase_17 AC 1,007 ms
14,480 KB
testcase_18 AC 1,592 ms
19,928 KB
testcase_19 AC 1,127 ms
15,372 KB
testcase_20 AC 599 ms
11,916 KB
testcase_21 AC 226 ms
10,464 KB
testcase_22 AC 664 ms
12,744 KB
testcase_23 AC 345 ms
11,008 KB
testcase_24 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
A = list(map(int, input().split()))
ans = 0
ct = 0
q = deque()

for a in A:
    if a not in q:
        q.append(a)
        ct += 1
    else:
        ans = max(ans, ct)
        while q[0] != a:
            q.popleft()
            ct -= 1
        q.popleft()
        q.append(a)
print(ans)
0