CSES - Datatähti 2023 loppu - Results
Submission details
Task:Kulut
Sender:okkokko
Submission time:2023-01-21 13:30:07 +0200
Language:Python3 (PyPy3)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2ACCEPTED0.04 sdetails
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.04 sdetails
#5ACCEPTED0.04 sdetails
#6ACCEPTED0.04 sdetails
#7ACCEPTED0.04 sdetails
#8ACCEPTED0.04 sdetails
#9ACCEPTED0.04 sdetails
#10ACCEPTED0.04 sdetails
#11ACCEPTED0.04 sdetails

Code

n = int(input())

maksut = {"A":0,"B":0,"C":0,"D":0}
total = 0
for _ in range(n):
    h,x = input().split()
    maksut[h]+=int(x)
    total+=int(x)
average = total//4
tries = 3
for h in "B","C","D":
    if maksut[h]:
        tries+=1
print(tries)
for h in "B","C","D":
    if maksut[h]:
        print("A",h,maksut[h])

for h in "B","C","D":
    print(h,"A",total//4)
quit()
out = []
times = 0

jarj = ["A","B","C","D"]
jarj.sort(key=lambda x: maksut[x],reverse=True)
for i in range(3):
    jarj[i]

Test details

Test 1

Verdict: ACCEPTED

input
100
C 224
D 4
D 624
D 64
...

correct output
3
A B 630
C B 1636
C D 1470

user output
6
A B 15392
A C 10020
A D 14596
B A 13126
...

Test 2

Verdict: ACCEPTED

input
100
D 768
B 608
A 116
C 80
...

correct output
3
B A 756
B C 1668
D C 1776

user output
6
A B 9452
A C 15320
A D 10100
B A 11876
...

Test 3

Verdict: ACCEPTED

input
100
B 184
C 840
D 648
A 876
...

correct output
3
A B 1131
B C 190
C D 297

user output
6
A B 12484
A C 11436
A D 11840
B A 11543
...

Test 4

Verdict: ACCEPTED

input
100
C 560
D 664
D 632
C 944
...

correct output
3
B A 3230
C B 2572
D C 1594

user output
6
A B 11108
A C 10788
A D 10172
B A 11766
...

Test 5

Verdict: ACCEPTED

input
100
B 20
A 664
D 504
A 248
...

correct output
3
A B 138
B C 652
C D 350

user output
6
A B 12272
A C 13088
A D 13136
B A 12786
...

Test 6

Verdict: ACCEPTED

input
100
B 204
D 520
C 500
C 256
...

correct output
3
B A 285
B C 482
C D 1321

user output
6
A B 11212
A C 11140
A D 13300
B A 11979
...

Test 7

Verdict: ACCEPTED

input
100
B 672
B 840
A 712
C 640
...

correct output
3
B A 324
C B 5128
D C 2920

user output
6
A B 18632
A C 11620
A D 10908
B A 13828
...

Test 8

Verdict: ACCEPTED

input
100
C 860
D 732
A 952
C 940
...

correct output
3
A B 24
C B 536
D C 2252

user output
6
A B 13364
A C 14520
A D 10552
B A 12804
...

Test 9

Verdict: ACCEPTED

input
100
C 84
A 592
B 840
C 708
...

correct output
3
A B 115
B C 1746
D C 3791

user output
6
A B 12392
A C 19560
A D 10232
B A 14023
...

Test 10

Verdict: ACCEPTED

input
1
A 100

correct output
3
B A 75
C B 50
D C 25

user output
3
B A 25
C A 25
D A 25

Test 11

Verdict: ACCEPTED

input
4
A 25
B 25
C 25
D 25

correct output
0

user output
6
A B 25
A C 25
A D 25
B A 25
...