結果
| 問題 |
No.2806 Cornflake Man
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-07-13 16:10:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 574 bytes |
| コンパイル時間 | 226 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 138,648 KB |
| 最終ジャッジ日時 | 2024-07-13 16:10:43 |
| 合計ジャッジ時間 | 7,015 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 1 -- * 5 |
ソースコード
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
if A[0] != 0:
print(-1)
exit()
AS = set(A)
B = set()
for a in A:
if a == 0:
continue
f = False
for b in B:
if a % b == 0:
f = True
continue
if f:
continue
f = False
for i in range(2, M // a + 1):
if i * a not in AS:
f = True
break
if f:
print(-1)
exit()
else:
B.add(a)
if len(B) == 0:
print(-1)
else:
print(len(B))
print(*sorted(list(B)))
ntuda