Submission #161504

#TimeUsernameProblemLanguageResultExecution timeMemory
161504boolodifjenulaPreokret (COCI18_preokret)Cpython 3
35 / 50
49 ms3468 KiB
A=int(input())
As=[int(input()) for i in range (A)]
B=int(input())
k=0
Bs=[]
Ak=0
Bk=0
v1=5
c=0
for i in range (A+B):
    if i<B:
        Bs+=[int(input())]
        if Bs[i-Bk]<=24*60:
            k+=1
    if i<A and As[i-Ak]<=24*60:
        k+=1
    if As and min(As[0],Bs[0]) in As:
        Ak+=bool(As.pop(0))
    elif Bs:
        Bk+=bool(Bs.pop(0))
    if Ak>Bk:
        v=1
    elif Bk>Ak:
        v=0
    if v!=v1:
        c+=1
        v1=v                
print(k)
print(c-1)
#Verdict Execution timeMemoryGrader output
Fetching results...