結果

問題 No.1782 ManyCoins
ユーザー chineristACchineristAC
提出日時 2021-12-11 23:08:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 118,776 KB
最終ジャッジ日時 2023-09-27 12:20:36
合計ジャッジ時間 18,126 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 130 ms
79,872 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 125 ms
79,736 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 133 ms
94,568 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 133 ms
94,880 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 133 ms
90,800 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 118 ms
74,836 KB
testcase_49 AC 120 ms
74,596 KB
testcase_50 AC 134 ms
94,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random
from collections import deque
from heapq import heappush,heappop

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,L = mi()
W = li()
M = max(W)

dist = [L+1 for i in range(M)]
dist[0] = 0
deq = deque([0])
while deq:
    r = deq.popleft()
    for i in range(N):
        c = (dist[r]*M+r+W[i])//M
        nr = (r+W[i])%M
        if dist[nr] > c:
            dist[nr] = c
            if c==dist[r]:
                deq.appendleft(nr)
            else:
                deq.append(nr)

D = [r+dist[i]*M for i in range(M)]
res = 0
for r in range(M):
    if D[r] <= L:
        res += (L-D[r])//M + 1

print(res-1)

0