Submission #73499617


Source Code Expand

# from 

def egg():
    n,d = map(int,input().split())
    buy = list(map(int,input().split()))
    use = list(map(int,input().split()))
    nex = 0
    for i in range(n):
        if buy[nex]-use[i]>=0:
            buy[nex]-=use[i]
        else:
            while nex<i or buy[nex]-use[i]<0 :
                # print(nex)
                use[i] -= buy[nex]
                buy[nex]-=buy[nex]
                
                nex+=1
                # print(buy)
        if buy[nex]==0:
            nex+=1
        if i-nex>=d:
            buy[nex]=0
            nex+=1
    if i-nex+1<d:
        buy[nex]=0
        nex+=1
        # print(buy)
    return sum(buy)

for i in range(int(input())):
    print(egg())

Submission Info

Submission Time
Task C - Omelette Restaurant
User tanuki33550336
Language Python (CPython 3.13.7)
Score 0
Code Size 737 Byte
Status RE
Exec Time 71 ms
Memory 24968 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 1
AC × 3
WA × 12
RE × 15
Set Name Test Cases
Sample example_00.txt
All example_00.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt WA 9 ms 9020 KiB
hand_00.txt WA 44 ms 23008 KiB
hand_01.txt AC 49 ms 23008 KiB
hand_02.txt RE 64 ms 24880 KiB
hand_03.txt WA 52 ms 24968 KiB
hand_04.txt AC 52 ms 24852 KiB
hand_05.txt RE 21 ms 11580 KiB
hand_06.txt RE 60 ms 16832 KiB
hand_07.txt RE 45 ms 12424 KiB
hand_08.txt AC 9 ms 9072 KiB
random_00.txt RE 21 ms 11560 KiB
random_01.txt RE 21 ms 11508 KiB
random_02.txt RE 21 ms 11544 KiB
random_03.txt RE 21 ms 11576 KiB
random_04.txt RE 21 ms 11536 KiB
random_05.txt RE 32 ms 11664 KiB
random_06.txt RE 42 ms 11588 KiB
random_07.txt RE 48 ms 11752 KiB
random_08.txt RE 30 ms 11564 KiB
random_09.txt RE 24 ms 11764 KiB
random_10.txt WA 59 ms 15764 KiB
random_11.txt WA 59 ms 15716 KiB
random_12.txt WA 59 ms 14964 KiB
random_13.txt WA 59 ms 14920 KiB
random_14.txt WA 59 ms 14920 KiB
random_15.txt WA 59 ms 14960 KiB
random_16.txt WA 59 ms 15764 KiB
random_17.txt WA 59 ms 15748 KiB
random_18.txt RE 71 ms 16276 KiB
random_19.txt WA 59 ms 15764 KiB