結果

問題 No.2779 Don't make Pair
コンテスト
ユーザー miho-4
提出日時 2024-06-07 23:17:30
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 96 ms / 2,000 ms
+ 218µs
コード長 346 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 67 ms
コンパイル使用メモリ 80,840 KB
実行使用メモリ 115,436 KB
最終ジャッジ日時 2026-10-08 06:38:43
合計ジャッジ時間 3,885 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
L=list(map(int,input().split()))
SL,SR=set(),set()
from collections import defaultdict
dr=defaultdict(int)

for e in L:
	dr[e]+=1
	if 2<=dr[e]:
		SR.add(e)

ans=[]
for i in range(n-1):
	e=L[i]
	if e not in SL:
		SL.add(e)
	else:
		break
	dr[e]-=1
	if dr[e]<=1:
		SR-={e}
	if SR==set():
		ans.append(i+1)
print(len(ans))
print(*ans)
0