| Task: | Old Legos |
| Sender: | aalto26bw_010 |
| Submission time: | 2026-09-09 17:10:14 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.04 s | details |
| #3 | ACCEPTED | 0.04 s | details |
| #4 | WRONG ANSWER | 0.04 s | details |
| #5 | ACCEPTED | 0.04 s | details |
| #6 | WRONG ANSWER | 0.04 s | details |
| #7 | WRONG ANSWER | 0.04 s | details |
| #8 | WRONG ANSWER | 0.04 s | details |
| #9 | ACCEPTED | 0.04 s | details |
| #10 | WRONG ANSWER | 0.04 s | details |
| #11 | WRONG ANSWER | 0.04 s | details |
| #12 | ACCEPTED | 0.04 s | details |
| #13 | WRONG ANSWER | 0.04 s | details |
| #14 | ACCEPTED | 0.04 s | details |
| #15 | ACCEPTED | 0.04 s | details |
| #16 | WRONG ANSWER | 0.04 s | details |
| #17 | ACCEPTED | 0.04 s | details |
| #18 | WRONG ANSWER | 0.04 s | details |
| #19 | ACCEPTED | 0.04 s | details |
| #20 | WRONG ANSWER | 0.04 s | details |
| #21 | WRONG ANSWER | 0.04 s | details |
| #22 | WRONG ANSWER | 0.04 s | details |
| #23 | WRONG ANSWER | 0.04 s | details |
| #24 | WRONG ANSWER | 0.04 s | details |
| #25 | WRONG ANSWER | 0.04 s | details |
| #26 | WRONG ANSWER | 0.04 s | details |
| #27 | WRONG ANSWER | 0.04 s | details |
| #28 | WRONG ANSWER | 0.04 s | details |
| #29 | WRONG ANSWER | 0.04 s | details |
| #30 | WRONG ANSWER | 0.04 s | details |
| #31 | WRONG ANSWER | 0.04 s | details |
| #32 | WRONG ANSWER | 0.04 s | details |
| #33 | WRONG ANSWER | 0.04 s | details |
| #34 | WRONG ANSWER | 0.04 s | details |
| #35 | WRONG ANSWER | 0.04 s | details |
| #36 | WRONG ANSWER | 0.04 s | details |
| #37 | WRONG ANSWER | 0.04 s | details |
| #38 | WRONG ANSWER | 0.04 s | details |
| #39 | WRONG ANSWER | 0.04 s | details |
| #40 | WRONG ANSWER | 0.04 s | details |
| #41 | WRONG ANSWER | 0.04 s | details |
| #42 | WRONG ANSWER | 0.04 s | details |
| #43 | WRONG ANSWER | 0.04 s | details |
| #44 | WRONG ANSWER | 0.04 s | details |
| #45 | WRONG ANSWER | 0.04 s | details |
| #46 | WRONG ANSWER | 0.04 s | details |
| #47 | WRONG ANSWER | 0.04 s | details |
| #48 | WRONG ANSWER | 0.04 s | details |
| #49 | WRONG ANSWER | 0.04 s | details |
| #50 | WRONG ANSWER | 0.05 s | details |
| #51 | WRONG ANSWER | 0.05 s | details |
| #52 | WRONG ANSWER | 0.05 s | details |
| #53 | WRONG ANSWER | 0.05 s | details |
| #54 | WRONG ANSWER | 0.05 s | details |
| #55 | WRONG ANSWER | 0.05 s | details |
| #56 | WRONG ANSWER | 0.05 s | details |
| #57 | WRONG ANSWER | 0.05 s | details |
| #58 | WRONG ANSWER | 0.05 s | details |
| #59 | WRONG ANSWER | 0.05 s | details |
| #60 | TIME LIMIT EXCEEDED | -- | details |
| #61 | TIME LIMIT EXCEEDED | -- | details |
| #62 | TIME LIMIT EXCEEDED | -- | details |
| #63 | TIME LIMIT EXCEEDED | -- | details |
| #64 | TIME LIMIT EXCEEDED | -- | details |
| #65 | TIME LIMIT EXCEEDED | -- | details |
| #66 | TIME LIMIT EXCEEDED | -- | details |
| #67 | TIME LIMIT EXCEEDED | -- | details |
| #68 | TIME LIMIT EXCEEDED | -- | details |
| #69 | TIME LIMIT EXCEEDED | -- | details |
Code
import sys
input_data = sys.stdin.read().split()
n = int(input_data[0])
u_s = []
m_s = []
id = 1
while(id<n*2):
u_s.append(int(input_data[id]))
m_s.append(int(input_data[id+1]))
id+=2
u_v=[]
for i in range(n):
if u_s[i]>= m_s[i]:
u_v.append(u_s[i])
else :
u_v.append(abs(u_s[i]-m_s[i]))
m_v = []
for i in range(n):
if m_s[i]>= u_s[i]:
m_v.append(m_s[i])
else :
m_v.append(abs(m_s[i]-u_s[i]))
id = 0
uolevi_total = 0
m_total = 0
uoblocks = []
mblocks= []
for id in range(n):
if id % 2 ==0:
#uolevi's turn
block = u_v.index(max(u_v))
uolevi_total += u_s[block] #add the og value of it
uoblocks.append(max(u_v))
u_s.pop(block)
u_v.pop(block)
m_s.pop(block)
m_v.pop(block)
else :
block = m_v.index(max(m_v))
m_total += m_s[block] #add the og value of it
mblocks.append(max(m_v))
u_s.pop(block)
u_v.pop(block)
m_s.pop(block)
m_v.pop(block)
'''print(uoblocks)
print(mblocks)'''
print(uolevi_total - m_total)
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 1 9 2 |
| correct output |
|---|
| 9 |
| user output |
|---|
| 9 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 1 10 4 |
| correct output |
|---|
| 10 |
| user output |
|---|
| 10 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 2 8 1 3 5 |
| correct output |
|---|
| 3 |
| user output |
|---|
| 3 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 2 2 9 3 10 |
| correct output |
|---|
| -6 |
| user output |
|---|
| -8 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 3 7 2 6 2 2 3 |
| correct output |
|---|
| 7 |
| user output |
|---|
| 7 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 3 3 2 7 9 3 8 |
| correct output |
|---|
| 2 |
| user output |
|---|
| -3 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 4 5 10 9 9 1 10 8 8 |
| correct output |
|---|
| -4 |
| user output |
|---|
| -8 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 4 3 2 7 9 3 8 4 6 |
| correct output |
|---|
| 1 |
| user output |
|---|
| -9 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 4 5 3 8 1 9 1 3 3 |
| correct output |
|---|
| 10 |
| user output |
|---|
| 10 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 9 3 6 5 2 2 5 ... |
| correct output |
|---|
| 5 |
| user output |
|---|
| 1 |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 5 10 8 10 1 2 4 10 2 ... |
| correct output |
|---|
| 17 |
| user output |
|---|
| 18 |
Test 12
Verdict: ACCEPTED
| input |
|---|
| 5 2 1 10 6 10 5 5 5 ... |
| correct output |
|---|
| 8 |
| user output |
|---|
| 8 |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 5 8 9 2 6 3 5 1 1 ... |
| correct output |
|---|
| 3 |
| user output |
|---|
| -8 |
Test 14
Verdict: ACCEPTED
| input |
|---|
| 5 6 1 9 3 3 6 2 10 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 15
Verdict: ACCEPTED
| input |
|---|
| 5 1 9 9 3 4 10 10 5 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 16
Verdict: WRONG ANSWER
| input |
|---|
| 5 4 1 1 1 1 10 1 6 ... |
| correct output |
|---|
| -4 |
| user output |
|---|
| -6 |
Test 17
Verdict: ACCEPTED
| input |
|---|
| 5 3 8 4 5 10 8 5 10 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 18
Verdict: WRONG ANSWER
| input |
|---|
| 5 10 3 4 2 3 2 7 5 ... |
| correct output |
|---|
| 11 |
| user output |
|---|
| 16 |
Test 19
Verdict: ACCEPTED
| input |
|---|
| 5 4 6 5 5 1 2 4 2 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 20
Verdict: WRONG ANSWER
| input |
|---|
| 10 3 9 3 6 5 2 2 5 ... |
| correct output |
|---|
| -5 |
| user output |
|---|
| -8 |
Test 21
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 8 10 1 2 4 10 2 ... |
| correct output |
|---|
| 20 |
| user output |
|---|
| 29 |
Test 22
Verdict: WRONG ANSWER
| input |
|---|
| 11 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 ... |
| correct output |
|---|
| 1075637330 |
| user output |
|---|
| 2290587067 |
Test 23
Verdict: WRONG ANSWER
| input |
|---|
| 10 8 9 2 6 3 5 1 1 ... |
| correct output |
|---|
| -3 |
| user output |
|---|
| -13 |
Test 24
Verdict: WRONG ANSWER
| input |
|---|
| 10 6 1 9 3 3 6 2 10 ... |
| correct output |
|---|
| -2 |
| user output |
|---|
| -7 |
Test 25
Verdict: WRONG ANSWER
| input |
|---|
| 11 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 ... |
| correct output |
|---|
| 1389122128 |
| user output |
|---|
| 1664113289 |
Test 26
Verdict: WRONG ANSWER
| input |
|---|
| 10 4 1 1 1 1 10 1 6 ... |
| correct output |
|---|
| -6 |
| user output |
|---|
| -8 |
Test 27
Verdict: WRONG ANSWER
| input |
|---|
| 11 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 ... |
| correct output |
|---|
| -124259424 |
| user output |
|---|
| -479362790 |
Test 28
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 3 4 2 3 2 7 5 ... |
| correct output |
|---|
| 4 |
| user output |
|---|
| 3 |
Test 29
Verdict: WRONG ANSWER
| input |
|---|
| 11 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 ... |
| correct output |
|---|
| 246913369 |
| user output |
|---|
| 795434897 |
Test 30
Verdict: WRONG ANSWER
| input |
|---|
| 101 3 906523441 3 585063857 454895875 2 2 469855690 ... |
| correct output |
|---|
| -1950121670 |
| user output |
|---|
| 316881864 |
Test 31
Verdict: WRONG ANSWER
| input |
|---|
| 100 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 ... |
| correct output |
|---|
| 2484533534 |
| user output |
|---|
| 3269676743 |
Test 32
Verdict: WRONG ANSWER
| input |
|---|
| 100 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 ... |
| correct output |
|---|
| 1162250085 |
| user output |
|---|
| 1134838517 |
Test 33
Verdict: WRONG ANSWER
| input |
|---|
| 100 760367935 901888417 130275571 548496961 3 469291685 20130523 1 ... |
| correct output |
|---|
| -513884705 |
| user output |
|---|
| 290549192 |
Test 34
Verdict: WRONG ANSWER
| input |
|---|
| 100 587586158 1 918715995 3 3 641621091 151896000 241061404 ... |
| correct output |
|---|
| 4449680753 |
| user output |
|---|
| 3597640136 |
Test 35
Verdict: WRONG ANSWER
| input |
|---|
| 100 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 ... |
| correct output |
|---|
| 2289597915 |
| user output |
|---|
| 3635023944 |
Test 36
Verdict: WRONG ANSWER
| input |
|---|
| 101 356460601 1 68992860 1 1 638932295 568887059 653343572 ... |
| correct output |
|---|
| -1011275811 |
| user output |
|---|
| -2292628106 |
Test 37
Verdict: WRONG ANSWER
| input |
|---|
| 100 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 ... |
| correct output |
|---|
| -3347612884 |
| user output |
|---|
| -6361745694 |
Test 38
Verdict: WRONG ANSWER
| input |
|---|
| 100 257096283 933290530 2 876668629 453495728 12239373 2 822553808 ... |
| correct output |
|---|
| -5234322969 |
| user output |
|---|
| -6396523942 |
Test 39
Verdict: WRONG ANSWER
| input |
|---|
| 101 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 ... |
| correct output |
|---|
| 1057263569 |
| user output |
|---|
| 491277805 |
Test 40
Verdict: WRONG ANSWER
| input |
|---|
| 200 3 906523441 3 585063857 454895875 2 2 469855690 ... |
| correct output |
|---|
| -1859110273 |
| user output |
|---|
| -1416358416 |
Test 41
Verdict: WRONG ANSWER
| input |
|---|
| 201 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 ... |
| correct output |
|---|
| -1706556434 |
| user output |
|---|
| -4191650421 |
Test 42
Verdict: WRONG ANSWER
| input |
|---|
| 200 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 ... |
| correct output |
|---|
| 2881192575 |
| user output |
|---|
| 4080667649 |
Test 43
Verdict: WRONG ANSWER
| input |
|---|
| 200 760367935 901888417 130275571 548496961 3 469291685 20130523 1 ... |
| correct output |
|---|
| 367410203 |
| user output |
|---|
| -47572697 |
Test 44
Verdict: WRONG ANSWER
| input |
|---|
| 201 587586158 1 918715995 3 3 641621091 151896000 241061404 ... |
| correct output |
|---|
| 6064184122 |
| user output |
|---|
| 4990084780 |
Test 45
Verdict: WRONG ANSWER
| input |
|---|
| 200 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 ... |
| correct output |
|---|
| -541796892 |
| user output |
|---|
| -711780438 |
Test 46
Verdict: WRONG ANSWER
| input |
|---|
| 200 356460601 1 68992860 1 1 638932295 568887059 653343572 ... |
| correct output |
|---|
| -3818748427 |
| user output |
|---|
| -7219994232 |
Test 47
Verdict: WRONG ANSWER
| input |
|---|
| 201 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 ... |
| correct output |
|---|
| 1128073230 |
| user output |
|---|
| -436487082 |
Test 48
Verdict: WRONG ANSWER
| input |
|---|
| 200 257096283 933290530 2 876668629 453495728 12239373 2 822553808 ... |
| correct output |
|---|
| -4097764173 |
| user output |
|---|
| -3143198025 |
Test 49
Verdict: WRONG ANSWER
| input |
|---|
| 201 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 ... |
| correct output |
|---|
| 4209206317 |
| user output |
|---|
| 5712745180 |
Test 50
Verdict: WRONG ANSWER
| input |
|---|
| 1001 3 906523441 3 585063857 454895875 2 2 469855690 ... |
| correct output |
|---|
| 797530744 |
| user output |
|---|
| 1136979410 |
Test 51
Verdict: WRONG ANSWER
| input |
|---|
| 1000 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 ... |
| correct output |
|---|
| -6859401550 |
| user output |
|---|
| -9975132005 |
Test 52
Verdict: WRONG ANSWER
| input |
|---|
| 1000 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 ... |
| correct output |
|---|
| 3341433705 |
| user output |
|---|
| 8046340946 |
Test 53
Verdict: WRONG ANSWER
| input |
|---|
| 1000 760367935 901888417 130275571 548496961 3 469291685 20130523 1 ... |
| correct output |
|---|
| 3932941646 |
| user output |
|---|
| 4215848371 |
Test 54
Verdict: WRONG ANSWER
| input |
|---|
| 1000 587586158 1 918715995 3 3 641621091 151896000 241061404 ... |
| correct output |
|---|
| 12940904658 |
| user output |
|---|
| 13710168119 |
Test 55
Verdict: WRONG ANSWER
| input |
|---|
| 1000 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 ... |
| correct output |
|---|
| -11353638361 |
| user output |
|---|
| -21329826210 |
Test 56
Verdict: WRONG ANSWER
| input |
|---|
| 1001 356460601 1 68992860 1 1 638932295 568887059 653343572 ... |
| correct output |
|---|
| 196162653 |
| user output |
|---|
| -7135867227 |
Test 57
Verdict: WRONG ANSWER
| input |
|---|
| 1000 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 ... |
| correct output |
|---|
| 8993059628 |
| user output |
|---|
| 20041463527 |
Test 58
Verdict: WRONG ANSWER
| input |
|---|
| 1000 257096283 933290530 2 876668629 453495728 12239373 2 822553808 ... |
| correct output |
|---|
| -11284740290 |
| user output |
|---|
| -5131387680 |
Test 59
Verdict: WRONG ANSWER
| input |
|---|
| 1001 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 ... |
| correct output |
|---|
| 12730443353 |
| user output |
|---|
| 28609049418 |
Test 60
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 3 906523441 3 585063857 454895875 2 2 469855690 ... |
| correct output |
|---|
| 105607728400 |
| user output |
|---|
| (empty) |
Test 61
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 ... |
| correct output |
|---|
| 21174476635 |
| user output |
|---|
| (empty) |
Test 62
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 ... |
| correct output |
|---|
| 65624350916 |
| user output |
|---|
| (empty) |
Test 63
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 760367935 901888417 130275571 548496961 3 469291685 20130523 1 ... |
| correct output |
|---|
| 66836037029 |
| user output |
|---|
| (empty) |
Test 64
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 587586158 1 918715995 3 3 641621091 151896000 241061404 ... |
| correct output |
|---|
| -87105533715 |
| user output |
|---|
| (empty) |
Test 65
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 ... |
| correct output |
|---|
| -1093858395 |
| user output |
|---|
| (empty) |
Test 66
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 99999 356460601 1 68992860 1 1 638932295 568887059 653343572 ... |
| correct output |
|---|
| -28178672820 |
| user output |
|---|
| (empty) |
Test 67
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 99999 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 ... |
| correct output |
|---|
| 72715249868 |
| user output |
|---|
| (empty) |
Test 68
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 99999 257096283 933290530 2 876668629 453495728 12239373 2 822553808 ... |
| correct output |
|---|
| -46790665125 |
| user output |
|---|
| (empty) |
Test 69
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 99999 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 ... |
| correct output |
|---|
| 12190306919 |
| user output |
|---|
| (empty) |
