結果
問題 | No.2806 Cornflake Man |
ユーザー |
![]() |
提出日時 | 2024-07-12 21:51:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 190 ms / 2,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 692 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 186,712 KB |
最終ジャッジ日時 | 2024-07-17 20:26:27 |
合計ジャッジ時間 | 2,900 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
N, M = map(int, input().split()) A = sorted(list(map(int, input().split()))) S = set(A[1:]) used = set() ans = [] for i in range(1, N): if A[i] not in S: continue ans.append(A[i]) for j in range(A[i], M+1, A[i]): if j not in S and j not in used: exit(print(-1)) if j not in used: S.remove(j) used.add(j) print(len(ans)) print(*ans)