結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
74,700 KB
testcase_01 AC 104 ms
79,964 KB
testcase_02 AC 92 ms
74,652 KB
testcase_03 AC 94 ms
74,728 KB
testcase_04 AC 92 ms
74,848 KB
testcase_05 AC 95 ms
74,636 KB
testcase_06 AC 90 ms
74,748 KB
testcase_07 AC 91 ms
74,816 KB
testcase_08 AC 94 ms
74,632 KB
testcase_09 AC 96 ms
74,652 KB
testcase_10 AC 96 ms
74,696 KB
testcase_11 AC 94 ms
74,816 KB
testcase_12 AC 96 ms
74,800 KB
testcase_13 AC 186 ms
96,620 KB
testcase_14 AC 363 ms
116,268 KB
testcase_15 AC 304 ms
101,520 KB
testcase_16 AC 345 ms
106,348 KB
testcase_17 AC 350 ms
114,912 KB
testcase_18 AC 316 ms
109,968 KB
testcase_19 AC 100 ms
79,888 KB
testcase_20 AC 447 ms
111,640 KB
testcase_21 AC 515 ms
118,072 KB
testcase_22 AC 680 ms
116,052 KB
testcase_23 AC 568 ms
114,860 KB
testcase_24 AC 114 ms
94,888 KB
testcase_25 AC 656 ms
116,708 KB
testcase_26 AC 284 ms
96,960 KB
testcase_27 AC 852 ms
118,608 KB
testcase_28 AC 111 ms
94,768 KB
testcase_29 AC 170 ms
96,912 KB
testcase_30 AC 187 ms
102,396 KB
testcase_31 AC 210 ms
102,136 KB
testcase_32 AC 217 ms
102,604 KB
testcase_33 AC 300 ms
102,444 KB
testcase_34 AC 278 ms
102,560 KB
testcase_35 AC 477 ms
102,548 KB
testcase_36 AC 144 ms
96,340 KB
testcase_37 AC 125 ms
94,612 KB
testcase_38 AC 121 ms
95,348 KB
testcase_39 AC 112 ms
84,112 KB
testcase_40 AC 115 ms
94,868 KB
testcase_41 AC 114 ms
91,620 KB
testcase_42 AC 115 ms
94,016 KB
testcase_43 AC 109 ms
90,908 KB
testcase_44 AC 115 ms
94,952 KB
testcase_45 AC 115 ms
93,244 KB
testcase_46 AC 119 ms
83,204 KB
testcase_47 AC 121 ms
83,124 KB
testcase_48 AC 93 ms
74,628 KB
testcase_49 AC 92 ms
74,840 KB
testcase_50 AC 110 ms
94,528 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]+((r+W[i])//M)
        nr = (r+W[i])%M
        if dist[nr] > c:
            dist[nr] = c
            if c==dist[r]:
                deq.appendleft(nr)
            else:
                assert c==dist[r]+1
                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