115902024-10-27 19:54:09balintJobstown-i milliomospython3Wrong answer 16/10017ms3496 KiB
def main():
    got_money = 0
    N, time_left = map(int, input().split())
    times = list(map(int, input().split()))
    moneys = list(map(int, input().split()))
    ratios = [(money / time, time, money) for time, money in zip(times, moneys)]
    ratios.sort(key=lambda x: x[0], reverse=True)  # sorts based on each element's ratio
    for ratio, time, money in ratios:
        if time_left >= time:
            job_usage = time_left // time
            time_left -= job_usage * time
            got_money += job_usage * money
    print(got_money)


main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3128 KiB
2Accepted16ms2960 KiB
subtask20/25
3Accepted17ms3128 KiB
4Accepted16ms3128 KiB
5Wrong answer17ms3260 KiB
6Wrong answer16ms3212 KiB
7Wrong answer17ms3276 KiB
8Wrong answer17ms3272 KiB
9Accepted16ms3136 KiB
10Accepted16ms3184 KiB
11Accepted17ms3236 KiB
12Accepted17ms3184 KiB
13Accepted17ms3272 KiB
14Accepted16ms3128 KiB
subtask316/16
15Accepted17ms3128 KiB
16Accepted16ms3236 KiB
17Accepted17ms3140 KiB
18Accepted17ms3128 KiB
19Accepted17ms3128 KiB
20Accepted16ms3144 KiB
21Accepted16ms3320 KiB
subtask40/59
22Accepted16ms3136 KiB
23Accepted17ms3128 KiB
24Wrong answer16ms3496 KiB
25Wrong answer16ms3128 KiB
26Wrong answer17ms3128 KiB
27Accepted17ms3192 KiB
28Accepted16ms3320 KiB
29Accepted17ms3240 KiB
30Accepted17ms3092 KiB
31Accepted16ms3064 KiB
32Wrong answer17ms3064 KiB
33Wrong answer16ms3216 KiB