結果

問題 No.1782 ManyCoins
ユーザー ytftytft
提出日時 2022-02-17 12:53:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 37,236 KB
最終ジャッジ日時 2023-09-11 17:38:43
合計ジャッジ時間 7,635 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
13,128 KB
testcase_01 AC 49 ms
8,904 KB
testcase_02 AC 19 ms
8,564 KB
testcase_03 AC 19 ms
8,544 KB
testcase_04 AC 19 ms
8,544 KB
testcase_05 WA -
testcase_06 AC 19 ms
8,648 KB
testcase_07 AC 18 ms
8,616 KB
testcase_08 AC 18 ms
8,504 KB
testcase_09 AC 19 ms
8,488 KB
testcase_10 AC 19 ms
8,512 KB
testcase_11 AC 18 ms
8,456 KB
testcase_12 WA -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,L=map(int,input().split())
W=list(map(int,input().split()))
W.sort()
dist=[-1 for i in range(W[N-1])]
dist[0]=0
q=deque([0])
while len(q):
	i=q.pop()
	for j in range(N-1):
		if dist[(i+W[j])%W[N-1]]==-1:
			if i+W[j]<W[N-1]:
				dist[(i+W[j])%W[N-1]]=dist[i]
				q.append((i+W[j])%W[N-1])
			else:
				dist[(i+W[j])%W[N-1]]=dist[i]+1
				q.appendleft((i+W[j])%W[N-1])
ans=L
for i in range(W[N-1]):
	ans-=min(dist[i],max(L-i,0)//W[N-1]+1)
print(ans)
0