結果

問題 No.2779 Don't make Pair
ユーザー shimonohnishishimonohnishi
提出日時 2024-06-09 21:09:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,728 KB
実行使用メモリ 106,068 KB
最終ジャッジ日時 2024-06-09 21:09:40
合計ジャッジ時間 3,547 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,772 KB
testcase_01 AC 33 ms
52,204 KB
testcase_02 AC 32 ms
53,032 KB
testcase_03 AC 32 ms
52,604 KB
testcase_04 AC 33 ms
53,032 KB
testcase_05 AC 32 ms
53,124 KB
testcase_06 AC 31 ms
52,888 KB
testcase_07 AC 31 ms
52,132 KB
testcase_08 AC 33 ms
52,884 KB
testcase_09 AC 41 ms
64,060 KB
testcase_10 AC 59 ms
83,828 KB
testcase_11 AC 42 ms
67,116 KB
testcase_12 AC 60 ms
84,988 KB
testcase_13 AC 59 ms
85,472 KB
testcase_14 AC 63 ms
86,264 KB
testcase_15 AC 87 ms
104,160 KB
testcase_16 AC 100 ms
106,068 KB
testcase_17 AC 80 ms
97,428 KB
testcase_18 AC 74 ms
92,120 KB
testcase_19 AC 81 ms
98,644 KB
testcase_20 AC 57 ms
79,584 KB
testcase_21 AC 88 ms
105,784 KB
testcase_22 AC 90 ms
105,384 KB
testcase_23 AC 101 ms
105,504 KB
testcase_24 AC 87 ms
105,492 KB
testcase_25 AC 89 ms
105,696 KB
testcase_26 AC 90 ms
105,836 KB
testcase_27 AC 94 ms
106,032 KB
testcase_28 AC 87 ms
105,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

d = {}
for i, a in enumerate(A):
    if a in d:
        d[a].append(i + 1)
    else:
        d[a] = [i + 1]

l, r = 2, N
for v in d.values():
    if len(v) == 1:
        continue
    if len(v) == 2:
        l = max(l, v[0] + 1)
        r = min(r, v[1])
    else:
        print(0)
        print()
        exit()

ans = list(range(l - 1, r))
print(len(ans))
print(*ans)
0