結果
問題 | No.2806 Cornflake Man |
ユーザー |
|
提出日時 | 2024-09-30 15:04:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 231 ms / 2,000 ms |
コード長 | 403 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 82,016 KB |
実行使用メモリ | 188,504 KB |
最終ジャッジ日時 | 2024-09-30 15:04:54 |
合計ジャッジ時間 | 3,676 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
N,M = map(int, input().split())A = list(map(int, input().split()))A.sort()from collections import defaultdictd = defaultdict(lambda:0)s_A = set(A)ans = []for i in A[1:]:if d[i] > 0:continuefor j in range(i,M+1,i):if j not in s_A:print(-1)exit()else:d[j] += 1ans.append(i)#print(d)print(len(ans))print(*ans)