| Task: | Roller coaster |
| Sender: | aalto26hw_002 |
| Submission time: | 2026-10-28 17:43:50 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.06 s | details |
| #2 | WRONG ANSWER | 0.06 s | details |
| #3 | WRONG ANSWER | 0.06 s | details |
| #4 | WRONG ANSWER | 0.06 s | details |
| #5 | ACCEPTED | 0.06 s | details |
| #6 | WRONG ANSWER | 0.06 s | details |
| #7 | WRONG ANSWER | 0.06 s | details |
| #8 | WRONG ANSWER | 0.06 s | details |
| #9 | WRONG ANSWER | 0.06 s | details |
| #10 | WRONG ANSWER | 0.06 s | details |
| #11 | WRONG ANSWER | 0.06 s | details |
| #12 | WRONG ANSWER | 0.06 s | details |
Code
import sys
import string
import math
n = int(input())
tracks = []
for i in range (n):
P, R, A, F = map(int, input().split())
tracks.append((P, R, A, F, False))
if n == 1:
currentSpeed = tracks[0][0]
print(currentSpeed)
else:
tracks.reverse()
costs = [i[0] - i[1] for i in tracks]
costs.sort()
cost_index = len(costs) // 2 + 1
#if len(costs) % 2 == 1:
# cost_index += 1
medianCost = costs[cost_index]
count = 0
for i in range (len(tracks)):
if (tracks[i][0] - tracks[i][1] < cost_index and count < cost_index):
count += 1
tracks[i] = (tracks[i][0], tracks[i][1], tracks[i][2], tracks[i][3], True)
#print(tracks[i])
startingSpeed = 0
currentSpeed = 0
prevCost = 0
for i in range (len(tracks) - 1):
currentCost = 0
if tracks[i][4]:
currentCost = tracks[i][0]
else:
currentCost = tracks[i][1]
if (currentSpeed > currentCost):
currentCost = currentSpeed
unitsLost = tracks[i+1][2]
percentageLost = tracks[i+1][3]
currentSpeed = ((currentCost + unitsLost) * 100) // (100 - percentageLost)
if 100*(currentSpeed - unitsLost - currentSpeed * percentageLost) < 100*currentCost:
currentSpeed += 1
print(currentSpeed)Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 3
1000 5 5 0 20 20 20 50 50 50 0 99 |
| correct output |
|---|
| 145 |
| user output |
|---|
| 146 |
Feedback: Incorrect character on line 1 col 3: expected "145", got "146"
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 10
1000000 1000000 1000000 99 1000000 1000000 1000000 99 1000000 1000000 1000000 99 1000000 1000000 1000000 99 ... |
| correct output |
|---|
| 2010101010101010100000000 |
| user output |
|---|
| 2010101020202020201010101 |
Feedback: Incorrect character on line 1 col 9: expected "201010101010...", got "201010102020..."
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 7
794772 933488 441001 5 271493 536110 509532 51 962838 821872 870163 38 499748 375441 611720 27 ... |
| correct output |
|---|
| 19316405 |
| user output |
|---|
| 19316414 |
Feedback: Incorrect character on line 1 col 7: expected "19316405", got "19316414"
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 3
596853 888598 841235 97 66172 267459 123646 63 797926 471325 495185 83 |
| correct output |
|---|
| 81642158 |
| user output |
|---|
| 81642167 |
Feedback: Incorrect character on line 1 col 7: expected "81642158", got "81642167"
Test 5
Verdict: ACCEPTED
| input |
|---|
| 1
96033 88994 378596 21 |
| correct output |
|---|
| 96033 |
| user output |
|---|
| 96033 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 4
621429 570665 136758 47 960437 633256 497081 80 609067 68711 635017 1 952965 878149 492025 33 |
| correct output |
|---|
| 19366822 |
| user output |
|---|
| 19366829 |
Feedback: Incorrect character on line 1 col 8: expected "19366822", got "19366829"
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 4
318031 108177 756250 50 502140 162500 94476 8 20779 421098 576089 37 839335 802331 61705 28 |
| correct output |
|---|
| 6474336 |
| user output |
|---|
| 6474339 |
Feedback: Incorrect character on line 1 col 7: expected "6474336", got "6474339"
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 10
267853 777820 375951 88 988230 882388 775839 83 967127 555787 30414 59 813651 989181 261150 83 ... |
| correct output |
|---|
| 114240784216 |
| user output |
|---|
| 114240795434 |
Feedback: Incorrect character on line 1 col 8: expected "114240784216", got "114240795434"
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 10
861881 84483 508595 97 274330 38611 473 18 695015 614973 493097 97 770531 391287 334900 98 ... |
| correct output |
|---|
| 26667465547194 |
| user output |
|---|
| 26667466495467 |
Feedback: Incorrect character on line 1 col 8: expected "26667465547194", got "26667466495467"
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 6
993908 158176 414002 83 50631 75954 861168 68 98702 383452 611097 7 953893 532084 225127 4 ... |
| correct output |
|---|
| 46921821 |
| user output |
|---|
| 46921871 |
Feedback: Incorrect character on line 1 col 7: expected "46921821", got "46921871"
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 4
388404 393603 132467 24 739054 45905 89323 17 259460 850672 530957 26 420175 673047 31765 58 |
| correct output |
|---|
| 2895218 |
| user output |
|---|
| 2353497 |
Feedback: Incorrect character on line 1 col 2: expected "2895218", got "2353497"
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 8
643002 391445 280110 17 195187 908655 709512 0 354760 527205 486247 77 84740 350249 581194 78 ... |
| correct output |
|---|
| 250399569 |
| user output |
|---|
| 240687425 |
Feedback: Incorrect character on line 1 col 2: expected "250399569", got "240687425"
