CSES - Datatähti 2022 alku - Results
Submission details
Task:Tietoverkko
Sender:Tipu
Submission time:2021-10-14 21:28:42 +0300
Language:Python3 (CPython3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.03 s1, 2, 3details
#20.04 s2, 3details
#30.59 s3details

Code

def kerro(välit, n):
    luku = 0
    i = 0
    while i < len(välit):
        luku += välit[i] * (n - 1 - i)
        i += 1
    return luku

def main():
    n = int(input())
    i = 0
    x = 0
    välit = []

    while i < n - 1:
        abx = input().split(" ")
        x = int(abx[2])
        välit.append(x)
        
        i += 1
    välit.sort()
    print(kerro(välit, n))
			
main() 

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
100
1 2 74
1 3 100
2 4 50
3 5 40
...

correct output
88687

user output
162632

Test 2

Group: 2, 3

Verdict:

input
5000
1 2 613084013
1 3 832364259
2 4 411999902
3 5 989696303
...

correct output
1103702320243776

user output
4183854306632911

Test 3

Group: 3

Verdict:

input
200000
1 2 613084013
1 3 832364259
2 4 411999902
3 5 989696303
...

correct output
1080549209850010931

user output
6652407974595782384