225622026-01-15 11:14:17vyrallBányász RPG (40 pont)pypy3Wrong answer 0/4079ms32000 KiB
n = int(input())
lvls = list(map(int, input().split()))
needed = list(map(int, input().split()))
mats = [[lvls[i], needed[i]] for i in range(n)]
mats.sort(key=lambda x: x[0])
lvl = 0
time = 0

l = 0
r = len(mats) - 1

while l <= r:
    if mats[l][0] <= lvl:
        time += mats[l][1]
        lvl += mats[l][1]
        l += 1
    else:
        time += 2*mats[r][1]
        lvl += mats[r][1]
        r -= 1

print(time)
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/039ms19696 KiB
2Wrong answer0/079ms24464 KiB
3Wrong answer0/243ms19584 KiB
4Wrong answer0/246ms21524 KiB
5Wrong answer0/263ms22500 KiB
6Wrong answer0/264ms27100 KiB
7Wrong answer0/250ms21768 KiB
8Wrong answer0/261ms22760 KiB
9Wrong answer0/339ms19416 KiB
10Wrong answer0/343ms19544 KiB
11Wrong answer0/337ms19432 KiB
12Wrong answer0/346ms21088 KiB
13Wrong answer0/454ms21452 KiB
14Wrong answer0/443ms21312 KiB
15Runtime error0/261ms32000 KiB
16Runtime error0/272ms32000 KiB
17Runtime error0/272ms32000 KiB
18Runtime error0/264ms32000 KiB