結果
問題 | No.2806 Cornflake Man |
ユーザー |
|
提出日時 | 2024-11-08 08:06:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 203 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 370 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 153,680 KB |
最終ジャッジ日時 | 2024-11-08 08:07:02 |
合計ジャッジ時間 | 3,706 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
N,M = map(int,input().split())A = sorted(list(map(int,input().split())))C = {}for i in range(1,N):C[A[i]] = 0B = []flag = 1for i in range(1,N):if C[A[i]]==0:C[A[i]] = 1B.append(A[i])for j in range(2*A[i],M+1,A[i]):if j not in C:flag = -1breakC[j] = 1if flag==-1:breakif flag==-1:print(flag)else:print(len(B))print(*B)