29832023-02-07 09:32:34lacitoVideójátékpython3Time limit exceeded 0/1002.099s163944 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) -> 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
1Accepted19ms11820 KiB
2Accepted18ms12348 KiB
subtask20/10
3Accepted17ms12360 KiB
4Accepted57ms12416 KiB
5Accepted17ms12584 KiB
6Accepted19ms13032 KiB
7Accepted17ms13200 KiB
8Accepted453ms13224 KiB
9Accepted17ms13468 KiB
10Accepted996ms13416 KiB
11Time limit exceeded2.069s5824 KiB
subtask30/20
12Accepted18ms13556 KiB
13Accepted82ms13904 KiB
14Time limit exceeded2.053s6328 KiB
15Accepted19ms14304 KiB
16Accepted19ms14348 KiB
17Time limit exceeded2.099s6780 KiB
18Time limit exceeded2.062s7228 KiB
19Time limit exceeded2.058s7256 KiB
20Wrong answer23ms15560 KiB
21Wrong answer24ms15620 KiB
22Wrong answer18ms14960 KiB
subtask40/30
23Accepted68ms29404 KiB
24Accepted218ms63408 KiB
25Accepted490ms147484 KiB
26Accepted583ms163944 KiB
27Accepted580ms163808 KiB
28Accepted209ms74476 KiB
29Wrong answer46ms26088 KiB
30Wrong answer48ms25240 KiB
31Accepted37ms20392 KiB
subtask50/40
32Wrong answer231ms30148 KiB
33Accepted1.907s69236 KiB
34Time limit exceeded2.063s61124 KiB
35Time limit exceeded2.081s74728 KiB
36Time limit exceeded2.072s82256 KiB
37Time limit exceeded2.072s82332 KiB
38Wrong answer351ms110756 KiB
39Wrong answer629ms129076 KiB
40Accepted155ms43440 KiB
41Wrong answer172ms59324 KiB