結果

問題 No.2779 Don't make Pair
ユーザー いまり💣🍠いまり💣🍠
提出日時 2024-06-07 23:19:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 120,960 KB
最終ジャッジ日時 2024-06-07 23:19:29
合計ジャッジ時間 3,094 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
51,840 KB
testcase_01 AC 34 ms
51,968 KB
testcase_02 AC 36 ms
51,712 KB
testcase_03 AC 35 ms
51,712 KB
testcase_04 AC 34 ms
51,840 KB
testcase_05 AC 34 ms
51,968 KB
testcase_06 AC 34 ms
51,584 KB
testcase_07 AC 34 ms
51,968 KB
testcase_08 AC 34 ms
52,096 KB
testcase_09 AC 39 ms
60,800 KB
testcase_10 AC 53 ms
76,928 KB
testcase_11 AC 46 ms
63,488 KB
testcase_12 AC 64 ms
80,512 KB
testcase_13 AC 60 ms
80,768 KB
testcase_14 AC 76 ms
88,648 KB
testcase_15 AC 86 ms
99,280 KB
testcase_16 AC 72 ms
93,696 KB
testcase_17 AC 88 ms
100,480 KB
testcase_18 AC 82 ms
95,616 KB
testcase_19 AC 78 ms
96,256 KB
testcase_20 AC 60 ms
77,824 KB
testcase_21 AC 74 ms
99,200 KB
testcase_22 AC 68 ms
90,368 KB
testcase_23 AC 116 ms
120,960 KB
testcase_24 AC 71 ms
94,848 KB
testcase_25 AC 83 ms
95,104 KB
testcase_26 AC 84 ms
102,144 KB
testcase_27 AC 96 ms
107,920 KB
testcase_28 AC 79 ms
100,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

found_num_l = dict()

# left = -1
right = N - 1
i = 0
while i < N:
    if A[i] in found_num_l:
        # left = found_num_l[A[i]]
        right = i
        break
    else:
        found_num_l[A[i]] = i
    i += 1

found_num_r = dict()
j = N - 1
# right = N
left = 0
while j >= 0:
    if A[j] in found_num_r:
        # right = found_num_r[A[j]]
        left = j
        break
    else:
        found_num_r[A[j]] = j
    j -= 1

# found_num = {**found_num_l, **found_num_r}
if left >= right:
    j_list = []
else:
    j_list = list(range(left + 1, right + 1))
j_list = list(range(left + 1, right + 1))
print(len(j_list))
print(*j_list)
0