28272023-01-28 16:13:43VMGoJoVideójátékpython3Time limit exceeded 0/1002.085s163760 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
1Accepted17ms11544 KiB
2Accepted17ms11764 KiB
subtask20/10
3Accepted17ms11988 KiB
4Accepted61ms12068 KiB
5Accepted17ms12380 KiB
6Accepted18ms12636 KiB
7Accepted17ms12504 KiB
8Accepted474ms12684 KiB
9Accepted17ms12880 KiB
10Accepted1.042s13156 KiB
11Time limit exceeded2.078s5348 KiB
subtask30/20
12Accepted17ms13076 KiB
13Accepted83ms12944 KiB
14Time limit exceeded2.066s5580 KiB
15Accepted18ms13852 KiB
16Accepted19ms14272 KiB
17Time limit exceeded2.062s6668 KiB
18Time limit exceeded2.071s6640 KiB
19Time limit exceeded2.066s7152 KiB
20Wrong answer20ms15232 KiB
21Wrong answer21ms15696 KiB
22Wrong answer18ms14708 KiB
subtask40/30
23Accepted67ms29084 KiB
24Accepted217ms63064 KiB
25Accepted493ms147308 KiB
26Accepted663ms163760 KiB
27Accepted670ms163696 KiB
28Accepted211ms74476 KiB
29Wrong answer46ms25616 KiB
30Wrong answer48ms25152 KiB
31Accepted35ms20368 KiB
subtask50/40
32Wrong answer237ms29976 KiB
33Accepted1.95s68912 KiB
34Time limit exceeded2.036s60712 KiB
35Time limit exceeded2.081s74104 KiB
36Time limit exceeded2.069s81868 KiB
37Time limit exceeded2.085s81916 KiB
38Wrong answer384ms110256 KiB
39Wrong answer635ms128764 KiB
40Accepted158ms43324 KiB
41Wrong answer170ms58996 KiB