結果
問題 | No.1782 ManyCoins |
ユーザー | chineristAC |
提出日時 | 2021-12-11 00:26:09 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,488 bytes |
コンパイル時間 | 725 ms |
コンパイル使用メモリ | 87,332 KB |
実行使用メモリ | 847,968 KB |
最終ジャッジ日時 | 2023-09-26 01:45:33 |
合計ジャッジ時間 | 23,997 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 117 ms
74,612 KB |
testcase_01 | AC | 207 ms
86,756 KB |
testcase_02 | AC | 116 ms
74,288 KB |
testcase_03 | AC | 114 ms
74,428 KB |
testcase_04 | AC | 117 ms
74,388 KB |
testcase_05 | AC | 119 ms
74,132 KB |
testcase_06 | AC | 114 ms
74,464 KB |
testcase_07 | AC | 117 ms
74,280 KB |
testcase_08 | AC | 116 ms
74,456 KB |
testcase_09 | AC | 118 ms
74,008 KB |
testcase_10 | AC | 116 ms
74,128 KB |
testcase_11 | AC | 118 ms
74,448 KB |
testcase_12 | AC | 117 ms
74,276 KB |
testcase_13 | AC | 796 ms
208,648 KB |
testcase_14 | AC | 408 ms
143,064 KB |
testcase_15 | AC | 450 ms
137,240 KB |
testcase_16 | AC | 880 ms
237,152 KB |
testcase_17 | AC | 1,083 ms
279,492 KB |
testcase_18 | AC | 869 ms
245,224 KB |
testcase_19 | AC | 123 ms
79,992 KB |
testcase_20 | AC | 477 ms
152,924 KB |
testcase_21 | AC | 317 ms
119,756 KB |
testcase_22 | AC | 564 ms
200,340 KB |
testcase_23 | AC | 1,689 ms
436,664 KB |
testcase_24 | AC | 554 ms
286,288 KB |
testcase_25 | AC | 197 ms
88,336 KB |
testcase_26 | AC | 1,092 ms
268,120 KB |
testcase_27 | AC | 203 ms
88,492 KB |
testcase_28 | AC | 510 ms
286,296 KB |
testcase_29 | AC | 859 ms
371,576 KB |
testcase_30 | AC | 1,088 ms
458,892 KB |
testcase_31 | MLE | - |
testcase_32 | TLE | - |
testcase_33 | MLE | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
ソースコード
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) numbers = Dijkstra(m) for r in range(m): for w in W: numbers.add_edge(r,(r+w)%m,w) D = numbers.shortest_path(0) res = 0 for r in range(m): if D[r] <= L: res += (L-D[r])//m + 1 print(res-1)