結果

問題 No.2779 Don't make Pair
コンテスト
ユーザー flippergo
提出日時 2025-07-05 14:28:40
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 126 ms / 2,000 ms
+ 710µs
コード長 474 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 250 ms
コンパイル使用メモリ 95,584 KB
実行使用メモリ 136,720 KB
最終ジャッジ日時 2026-07-13 01:24:54
合計ジャッジ時間 5,261 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = [0]+list(map(int,input().split()))
j = 1
flagL = 0
flagR = 0
L = {}
L[A[1]] = 1
R = {}
for i in range(N,j,-1):
    R[A[i]] = R.get(A[i],0)+1
    if R[A[i]]==2:
        flagR += 1
ans = []
if flagL==0 and flagR==0:
    ans.append(1)
for j in range(2,N):
    a = A[j]
    L[a] = L.get(a,0)+1
    if L[a]==2:
        flagL += 1
    R[a] -= 1
    if R[a]==1:
        flagR -= 1
    if flagL==0 and flagR==0:
        ans.append(j)
print(len(ans))
print(*ans)
0