結果
問題 | No.1782 ManyCoins |
ユーザー | chineristAC |
提出日時 | 2021-12-11 00:28:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 318 ms / 2,000 ms |
コード長 | 1,607 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 86,048 KB |
最終ジャッジ日時 | 2024-07-18 21:14:05 |
合計ジャッジ時間 | 6,553 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
56,320 KB |
testcase_01 | AC | 47 ms
61,952 KB |
testcase_02 | AC | 45 ms
56,448 KB |
testcase_03 | AC | 42 ms
56,192 KB |
testcase_04 | AC | 46 ms
56,064 KB |
testcase_05 | AC | 44 ms
56,064 KB |
testcase_06 | AC | 48 ms
56,192 KB |
testcase_07 | AC | 45 ms
56,192 KB |
testcase_08 | AC | 45 ms
56,064 KB |
testcase_09 | AC | 45 ms
56,192 KB |
testcase_10 | AC | 41 ms
55,936 KB |
testcase_11 | AC | 41 ms
56,064 KB |
testcase_12 | AC | 40 ms
56,320 KB |
testcase_13 | AC | 75 ms
80,460 KB |
testcase_14 | AC | 129 ms
78,928 KB |
testcase_15 | AC | 148 ms
79,236 KB |
testcase_16 | AC | 233 ms
83,820 KB |
testcase_17 | AC | 251 ms
84,772 KB |
testcase_18 | AC | 232 ms
85,260 KB |
testcase_19 | AC | 45 ms
62,080 KB |
testcase_20 | AC | 157 ms
80,856 KB |
testcase_21 | AC | 116 ms
78,516 KB |
testcase_22 | AC | 171 ms
82,112 KB |
testcase_23 | AC | 303 ms
86,048 KB |
testcase_24 | AC | 54 ms
69,888 KB |
testcase_25 | AC | 96 ms
77,416 KB |
testcase_26 | AC | 250 ms
84,848 KB |
testcase_27 | AC | 94 ms
77,368 KB |
testcase_28 | AC | 54 ms
70,144 KB |
testcase_29 | AC | 94 ms
84,692 KB |
testcase_30 | AC | 64 ms
76,368 KB |
testcase_31 | AC | 140 ms
84,920 KB |
testcase_32 | AC | 182 ms
84,808 KB |
testcase_33 | AC | 318 ms
85,072 KB |
testcase_34 | AC | 95 ms
85,032 KB |
testcase_35 | AC | 97 ms
85,248 KB |
testcase_36 | AC | 92 ms
78,428 KB |
testcase_37 | AC | 77 ms
78,052 KB |
testcase_38 | AC | 45 ms
62,336 KB |
testcase_39 | AC | 46 ms
63,232 KB |
testcase_40 | AC | 52 ms
67,200 KB |
testcase_41 | AC | 58 ms
69,120 KB |
testcase_42 | AC | 45 ms
62,976 KB |
testcase_43 | AC | 48 ms
67,796 KB |
testcase_44 | AC | 45 ms
62,592 KB |
testcase_45 | AC | 65 ms
68,224 KB |
testcase_46 | AC | 46 ms
62,208 KB |
testcase_47 | AC | 48 ms
61,952 KB |
testcase_48 | AC | 42 ms
56,320 KB |
testcase_49 | AC | 41 ms
56,064 KB |
testcase_50 | AC | 50 ms
69,888 KB |
ソースコード
class Dijkstra(): class Edge(): def __init__(self, _to, _cost): self.to = _to self.cost = _cost def __init__(self, V): self.G = [[] for i in range(V)] self._E = 0 self._V = V @property def E(self): return self._E @property def V(self): return self._V def add_edge(self, _from, _to, _cost): self.G[_from].append(self.Edge(_to, _cost)) self._E += 1 def shortest_path(self, s): import heapq que = [] d = [10**15] * self.V d[s] = 0 heapq.heappush(que, (0, s)) while len(que) != 0: cost, v = heapq.heappop(que) if d[v] < cost: continue for i in range(len(self.G[v])): e = self.G[v][i] if d[e.to] > d[v] + e.cost: d[e.to] = d[v] + e.cost heapq.heappush(que, (d[e.to], e.to)) return d import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline() mi = lambda :map(int,input().split()) li = lambda :list(mi()) N,L = mi() W = li() m = min(W) D = [L+1 for i in range(m)] D[0] = 0 pq = [(0,0)] while pq: d,v = heappop(pq) if D[v] < d: continue for w in W: if D[(v+w)%m] > D[v] + w: D[(v+w)%m] = D[v] + w heappush(pq,(D[v]+w,(v+w)%m)) res = 0 for r in range(m): if D[r] <= L: res += (L-D[r])//m + 1 print(res-1)