結果
| 問題 |
No.2806 Cornflake Man
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-12 21:35:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 240 ms / 2,000 ms |
| コード長 | 684 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 156,372 KB |
| 最終ジャッジ日時 | 2024-07-17 20:26:07 |
| 合計ジャッジ時間 | 4,705 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
#n = int(input())
#
#alist = []
input = sys.stdin.readline
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = []
check = [0 for i in range(n)]
check[0] = 1
c = collections.defaultdict(lambda :-1)
for i in range(n):
c[a[i]] = i
for i in range(1,n):
if check[i] == 0:
x = a[i]
while x <= m:
check[c[x]] = 1
if c[x] == -1:
exit(print(-1))
x += a[i]
b.append(a[i])
print(len(b))
print(*b)