結果
| 問題 |
No.2779 Don't make Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-12 11:13:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 151 ms / 2,000 ms |
| コード長 | 381 bytes |
| コンパイル時間 | 346 ms |
| コンパイル使用メモリ | 81,888 KB |
| 実行使用メモリ | 107,128 KB |
| 最終ジャッジ日時 | 2024-06-12 11:13:16 |
| 合計ジャッジ時間 | 5,427 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 24 |
ソースコード
N = int(input()) A = list(map(int,input().split())) from collections import defaultdict h = defaultdict(int) hh = 0 m = defaultdict(int) mm = 0 for a in A: m[a] += 1 if m[a] == 2: mm += 1 ans = [] for j in range(N - 1): a = A[j] h[a] += 1 if h[a] == 2: hh += 1 m[a] -= 1 if m[a] == 1: mm -= 1 if hh == 0 and mm == 0: ans.append(j + 1) print(len(ans)) print(*ans)