Submission #1872886
Source Code Expand
import numpy as np from copy import deepcopy def dijkstra(N, matrix, s): d = [np.inf for _ in range(N)] d[s] = 0 prev = [-1 for _ in range(N)] Q = set([i for i in range(N)]) def min_index(): mi = np.inf mii = 0 for i in Q: if d[i] < mi: mii = i return mii while Q: u = min_index() Q.remove(u) for v in range(N): if matrix[u][v] >= 0: alt = d[u] + matrix[u][v] if d[v] > alt: d[v] = alt prev[v] = u return d H, W = map(int, input().split()) c = [] for _ in range(10): c.append([int(x) for x in input().split()]) c_tmp = deepcopy(c) for i in range(10): for j in range(10): c_tmp[i][j] = c[j][i] c = c_tmp k = [0 for _ in range(10)] for i in range(H): xs = [int(x) for x in input().split()] for x in xs: if x > 0: k[x] += 1 d = dijkstra(10, c, 1) count = 0 for i in range(10): if i != 1: count += d[i] * k[i] print(count)
Submission Info
Submission Time | |
---|---|
Task | A - Good Integer |
User | izziiyt |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1146 Byte |
Status | RE |
Exec Time | 151 ms |
Memory | 12232 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | RE | 149 ms | 12232 KB |
02.txt | RE | 148 ms | 12232 KB |
03.txt | RE | 148 ms | 12232 KB |
04.txt | RE | 149 ms | 12232 KB |
05.txt | RE | 149 ms | 12232 KB |
06.txt | RE | 151 ms | 12232 KB |
07.txt | RE | 148 ms | 12232 KB |
08.txt | RE | 149 ms | 12232 KB |
09.txt | RE | 147 ms | 12232 KB |
10.txt | RE | 147 ms | 12232 KB |
11.txt | RE | 150 ms | 12232 KB |
sample_01.txt | RE | 148 ms | 12232 KB |
sample_02.txt | RE | 148 ms | 12232 KB |
sample_03.txt | RE | 150 ms | 12232 KB |