Task: | Tietoverkko |
Sender: | Tipu |
Submission time: | 2021-10-13 23:02:37 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.03 s | 1, 2, 3 | details |
#2 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
def määritä(a, b, x, pienimmät): # print("määritys") i = 0 store = [row[:] for row in pienimmät] while i < len(pienimmät): if not store[i][a] == 0: if store[i][a] < x: # print("yksi") pienimmät[i][b] = pienimmät[i][a] else: pienimmät[i][b] = x # print("kaksi", i) if not store[i][b] == 0: if store[i][b] < x: pienimmät[i][a] = pienimmät[i][a] # print("kolme") else: pienimmät[i][a] = x # print("neljä", i) i += 1 pienimmät[a][b] = x pienimmät[b][a] = x # print(pienimmät) return pienimmät def laske(verkko): # print(verkko) i = 1 luku = 0 for kone in verkko[:-1]: saveI = i while i < len(kone) - 1: # print(kone[i],kone, i) luku += kone[i] i += 1 i = saveI + 1 return luku def main(): n = int(input()) # print(n) i = 0 a = [] b = [] x = [] pienimmät = [[0 for x in range(n+1)] for y in range(n+1)] while i < n - 1: abx = input().split(" ") a = int(abx[0]) b = int(abx[1]) x = int(abx[2]) # print(a, b, x) pienimmät = määritä(a - 1, b - 1, x, pienimmät) i += 1 print(laske(pienimmät)) # print("moi") main()
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
100 1 2 74 1 3 100 2 4 50 3 5 40 ... |
correct output |
---|
88687 |
user output |
---|
23177 |
Test 2
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
5000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1103702320243776 |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1080549209850010931 |
user output |
---|
(empty) |