結果
| 問題 | No.2779 Don't make Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-07 22:30:18 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 2,000 ms |
| コード長 | 387 bytes |
| 記録 | |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 124,672 KB |
| 最終ジャッジ日時 | 2026-06-01 06:24:36 |
| 合計ジャッジ時間 | 3,596 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 24 |
ソースコード
from collections import defaultdict
N=int(input())
A=list(map(int,input().split()))
d1=defaultdict(int)
d2=defaultdict(int)
for a in A:d1[a]+=1
cnt1=0
cnt2=0
for _,v in d1.items():
if v>1:cnt1+=1
ans=[]
for i in range(N-1):
a=A[i]
d1[a]-=1
d2[a]+=1
if d1[a]==1:cnt1-=1
if d2[a]>1:cnt2+=1
if cnt1==0 and cnt2==0:ans.append(i+1)
print(len(ans))
print(*ans)