結果
問題 |
No.1782 ManyCoins
|
ユーザー |
![]() |
提出日時 | 2022-02-17 12:53:04 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 480 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 40,192 KB |
最終ジャッジ日時 | 2024-06-29 07:38:31 |
合計ジャッジ時間 | 7,239 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 2 TLE * 2 -- * 36 |
ソースコード
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)