結果
| 問題 | No.2779 Don't make Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-08 07:20:13 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 123 ms / 2,000 ms |
| コード長 | 746 bytes |
| 記録 | |
| コンパイル時間 | 121 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 118,784 KB |
| 最終ジャッジ日時 | 2026-06-01 22:19:08 |
| 合計ジャッジ時間 | 3,735 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 24 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
from collections import defaultdict
from collections import Counter
C = Counter(A)
if C.most_common()[0][1] > 2:
# print('aaaaaa')
print(0)
print()
exit()
elif C.most_common()[0][1] == 1:
print(len(A)-1)
print(*list(range(1, N)))
exit()
LR = []
cnt = defaultdict(int)
stt = []
end = []
for i in range(N):
x = A[i]
cnt[x] += 1
if C[x] >= 2 and cnt[x] == 1:
stt.append(i)
if C[x] >= 2 and cnt[x] == C[x]:
end.append(i)
stt.sort()
end.sort()
l = stt[-1]
r = end[0]
# print(l, r, stt, end)
if l > r:
# print(l, r, stt, end)
print(0)
print()
exit()
else:
print(r - l)
ans = list(range(l+1, r+1))
print(*ans)