結果

問題 No.2779 Don't make Pair
ユーザー dp_ijkdp_ijk
提出日時 2024-06-18 00:29:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 82,832 KB
実行使用メモリ 107,384 KB
最終ジャッジ日時 2024-06-18 00:29:58
合計ジャッジ時間 6,423 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
S = Counter()
T = Counter(A)
X = 0
Y = len(T)

ans = []
for i, a in enumerate(A, 1):
   S[a] += 1
   if S[a] == 1:
      X += 1
   T[a] -= 1
   if T[a] == 0:
      Y -= 1
      del T[a]
   if X == i and Y == N-i and i != N:
      ans.append(i)

print(len(ans))
print(*ans)
0