結果

問題 No.2779 Don't make Pair
ユーザー hiro1729hiro1729
提出日時 2024-06-07 21:34:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 102,564 KB
最終ジャッジ日時 2024-06-07 21:34:47
合計ジャッジ時間 3,903 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,632 KB
testcase_01 AC 42 ms
52,992 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 41 ms
53,120 KB
testcase_05 AC 43 ms
53,376 KB
testcase_06 WA -
testcase_07 AC 41 ms
53,248 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 87 ms
93,696 KB
testcase_13 AC 97 ms
94,336 KB
testcase_14 WA -
testcase_15 AC 105 ms
99,840 KB
testcase_16 AC 99 ms
98,944 KB
testcase_17 AC 99 ms
96,768 KB
testcase_18 WA -
testcase_19 AC 103 ms
99,328 KB
testcase_20 AC 84 ms
85,632 KB
testcase_21 AC 107 ms
98,336 KB
testcase_22 AC 103 ms
98,272 KB
testcase_23 AC 152 ms
102,564 KB
testcase_24 AC 104 ms
97,920 KB
testcase_25 AC 103 ms
98,048 KB
testcase_26 AC 104 ms
98,176 KB
testcase_27 AC 113 ms
98,176 KB
testcase_28 AC 105 ms
98,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
m = 0
M = n - 1
d = defaultdict(list)
for i in range(n):
	d[a[i]].append(i)
for i, j in d.items():
	if len(j) > 2:
		exit(print(0))
	if len(j) == 2:
		m = max(m, j[0] + 1)
		M = min(M, j[1])
ans = list(range(m, M + 1))
print(len(ans))
print(*ans)
0