結果
問題 |
No.2779 Don't make Pair
|
ユーザー |
|
提出日時 | 2025-07-05 14:28:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 125 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 82,332 KB |
実行使用メモリ | 108,600 KB |
最終ジャッジ日時 | 2025-07-05 14:28:45 |
合計ジャッジ時間 | 4,628 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 24 |
ソースコード
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)