結果
問題 | No.2779 Don't make Pair |
ユーザー | tkykwtnb |
提出日時 | 2024-06-07 22:02:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 82,104 KB |
実行使用メモリ | 151,644 KB |
最終ジャッジ日時 | 2024-06-07 22:02:35 |
合計ジャッジ時間 | 4,472 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
53,376 KB |
testcase_01 | AC | 44 ms
53,632 KB |
testcase_02 | AC | 46 ms
53,632 KB |
testcase_03 | AC | 43 ms
53,504 KB |
testcase_04 | AC | 43 ms
53,376 KB |
testcase_05 | AC | 44 ms
53,376 KB |
testcase_06 | AC | 43 ms
53,376 KB |
testcase_07 | AC | 42 ms
53,376 KB |
testcase_08 | AC | 43 ms
53,504 KB |
testcase_09 | AC | 57 ms
65,664 KB |
testcase_10 | AC | 79 ms
85,760 KB |
testcase_11 | AC | 61 ms
69,376 KB |
testcase_12 | AC | 109 ms
100,352 KB |
testcase_13 | AC | 106 ms
99,328 KB |
testcase_14 | AC | 103 ms
91,668 KB |
testcase_15 | AC | 135 ms
105,436 KB |
testcase_16 | AC | 140 ms
108,592 KB |
testcase_17 | AC | 133 ms
107,872 KB |
testcase_18 | AC | 121 ms
100,224 KB |
testcase_19 | AC | 127 ms
101,440 KB |
testcase_20 | AC | 96 ms
88,448 KB |
testcase_21 | AC | 152 ms
113,244 KB |
testcase_22 | AC | 138 ms
108,288 KB |
testcase_23 | AC | 193 ms
151,644 KB |
testcase_24 | AC | 149 ms
108,628 KB |
testcase_25 | AC | 145 ms
109,136 KB |
testcase_26 | AC | 168 ms
116,784 KB |
testcase_27 | AC | 166 ms
119,512 KB |
testcase_28 | AC | 153 ms
115,632 KB |
ソースコード
from collections import defaultdict N=int(input()) A=list(map(int,input().split())) C=[0 for _ in range(N)] D=defaultdict(int) for i,a in enumerate(A): D[a]+=1 C[i]=D[a] ans1=[] for i,c in enumerate(C[:-1],1): if c==1:ans1.append(i) else:break C=[0 for _ in range(N)] D=defaultdict(int) for i in range(N-1,-1,-1): D[A[i]]+=1 C[i]=D[A[i]] ans2=[] for i in range(N-1,-1,-1): if C[i]==1:ans2.append(i) else:break ans=sorted(set(ans1)&set(ans2)) print(len(ans)) print(*ans)