結果

問題 No.1782 ManyCoins
ユーザー chineristACchineristAC
提出日時 2021-12-11 23:09:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,582 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 118,436 KB
最終ジャッジ日時 2023-09-27 12:21:21
合計ジャッジ時間 18,107 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
74,816 KB
testcase_01 AC 130 ms
79,860 KB
testcase_02 AC 117 ms
74,420 KB
testcase_03 AC 118 ms
74,840 KB
testcase_04 AC 120 ms
74,628 KB
testcase_05 AC 119 ms
74,820 KB
testcase_06 AC 118 ms
74,624 KB
testcase_07 AC 118 ms
75,036 KB
testcase_08 AC 116 ms
75,012 KB
testcase_09 AC 117 ms
74,632 KB
testcase_10 AC 118 ms
74,772 KB
testcase_11 AC 117 ms
74,856 KB
testcase_12 AC 117 ms
74,844 KB
testcase_13 AC 272 ms
96,388 KB
testcase_14 AC 585 ms
116,276 KB
testcase_15 AC 460 ms
101,412 KB
testcase_16 AC 477 ms
106,452 KB
testcase_17 AC 555 ms
115,296 KB
testcase_18 AC 446 ms
109,512 KB
testcase_19 AC 121 ms
79,532 KB
testcase_20 AC 689 ms
111,800 KB
testcase_21 AC 840 ms
118,388 KB
testcase_22 AC 1,220 ms
116,256 KB
testcase_23 AC 979 ms
114,464 KB
testcase_24 AC 139 ms
95,092 KB
testcase_25 AC 1,168 ms
116,644 KB
testcase_26 AC 430 ms
97,212 KB
testcase_27 AC 1,582 ms
118,436 KB
testcase_28 AC 136 ms
95,000 KB
testcase_29 AC 198 ms
96,816 KB
testcase_30 AC 230 ms
102,340 KB
testcase_31 AC 238 ms
102,608 KB
testcase_32 AC 256 ms
102,088 KB
testcase_33 AC 344 ms
102,300 KB
testcase_34 AC 311 ms
102,204 KB
testcase_35 AC 543 ms
102,172 KB
testcase_36 AC 186 ms
96,260 KB
testcase_37 AC 152 ms
94,668 KB
testcase_38 AC 147 ms
95,016 KB
testcase_39 AC 140 ms
83,848 KB
testcase_40 AC 143 ms
94,640 KB
testcase_41 AC 143 ms
91,332 KB
testcase_42 AC 140 ms
93,880 KB
testcase_43 AC 133 ms
90,996 KB
testcase_44 AC 142 ms
95,052 KB
testcase_45 AC 147 ms
92,836 KB
testcase_46 AC 155 ms
83,388 KB
testcase_47 AC 149 ms
83,092 KB
testcase_48 AC 120 ms
74,948 KB
testcase_49 AC 117 ms
74,948 KB
testcase_50 AC 140 ms
94,884 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 = [i+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