結果
| 問題 |
No.2779 Don't make Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-07 21:34:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 335 bytes |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 102,312 KB |
| 最終ジャッジ日時 | 2024-12-26 07:16:24 |
| 合計ジャッジ時間 | 4,419 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 2 |
| other | AC * 17 WA * 7 |
ソースコード
from collections import defaultdict n = int(input()) a = list(map(int, input().split())) m = 0 M = n - 1 d = defaultdict(list) for i in range(n): d[a[i]].append(i) for i, j in d.items(): if len(j) > 2: exit(print(0)) if len(j) == 2: m = max(m, j[0] + 1) M = min(M, j[1]) ans = list(range(m, M + 1)) print(len(ans)) print(*ans)