28262023-01-28 16:11:04VMGoJoVideójátékpython3Time limit exceeded 0/1002.099s164104 KiB
from sys import stdin, stdout

def main():
    
    global hanop
    hanop = int(0)
    t = int(stdin.readline())
    n = int(stdin.readline())
    te_szuneted=[]
    hano_szunete=[]
    for i in range(0,n):
        te_szuneted.append(stdin.readline().split())
    m = int(stdin.readline())
    for j in range(m):
        hano_szunete.append(stdin.readline().split())
    #print(te_szuneted)
    #print(hano_szunete)
    opercek:int = 0
    tszam:int = 0
    te_szuneted = [[int(j) for j in i] for i in te_szuneted]
    hano_szunete = [[int(j) for j in i] for i in hano_szunete]
    #print(te_szuneted)
    #print(hano_szunete)
    def online(ido:int, hano_szunete_p:list[list[int]]) -> bool:
        global hanop
        try:
            while hano_szunete_p[hanop][1] < ido:
                hanop+=1
                if hanop>=len(hano_szunete_p):
                    return False
        except Exception:return False
        
        if hano_szunete_p[hanop][0] <= ido:
            return True
        else:
            #print(f"false, ido: {ido} ")
            return False
    for i in te_szuneted:
        for j in range(i[0],i[1]+1):
            #print("ido: "+str(j))
            tszam+=1
            if online(j,hano_szunete):
                tszam = 0
                #print(f"i: {i} j: {j}")
                opercek+=1
            if tszam==t:
                break
        tszam=0
    stdout.write(str(int(opercek)))
    return 0
main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted19ms12240 KiB
2Accepted17ms12688 KiB
subtask20/10
3Accepted17ms12764 KiB
4Accepted57ms12900 KiB
5Accepted17ms13060 KiB
6Accepted18ms13516 KiB
7Accepted17ms13576 KiB
8Accepted472ms13808 KiB
9Accepted17ms13968 KiB
10Accepted1.042s13900 KiB
11Time limit exceeded2.078s5844 KiB
subtask30/20
12Accepted17ms13820 KiB
13Accepted86ms13944 KiB
14Time limit exceeded2.046s6572 KiB
15Accepted17ms14692 KiB
16Accepted20ms14776 KiB
17Time limit exceeded2.099s7084 KiB
18Time limit exceeded2.051s7276 KiB
19Time limit exceeded2.023s7472 KiB
20Wrong answer20ms15464 KiB
21Wrong answer21ms16000 KiB
22Wrong answer18ms15176 KiB
subtask40/30
23Accepted68ms29844 KiB
24Accepted202ms63348 KiB
25Accepted492ms147388 KiB
26Accepted580ms163708 KiB
27Accepted586ms164104 KiB
28Accepted210ms74696 KiB
29Wrong answer48ms26340 KiB
30Wrong answer46ms25084 KiB
31Accepted37ms20428 KiB
subtask50/40
32Wrong answer233ms30140 KiB
33Accepted1.97s68996 KiB
34Time limit exceeded2.04s60972 KiB
35Time limit exceeded2.072s74592 KiB
36Time limit exceeded2.076s82380 KiB
37Time limit exceeded2.026s82444 KiB
38Wrong answer361ms110644 KiB
39Wrong answer588ms129072 KiB
40Accepted156ms43700 KiB
41Wrong answer170ms59328 KiB