結果
| 問題 |
No.2779 Don't make Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-08 07:19:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 744 bytes |
| コンパイル時間 | 904 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 109,056 KB |
| 最終ジャッジ日時 | 2024-12-27 05:34:14 |
| 合計ジャッジ時間 | 4,401 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 WA * 1 |
| other | AC * 21 WA * 3 |
ソースコード
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))
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)