結果
問題 |
No.2779 Don't make Pair
|
ユーザー |
|
提出日時 | 2024-06-07 21:33:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 102,480 KB |
最終ジャッジ日時 | 2024-12-26 07:14:23 |
合計ジャッジ時間 | 4,803 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]) M = min(M, j[1]) ans = list(range(m + 1, M + 1)) print(len(ans)) print(*ans)