57362023-09-11 01:22:33KezdőÁruszállítás üres szakaszaipython3Time limit exceeded 35/50372ms67400 KiB
from sys import stdin

def main():
    N, M = [int(i) for i in input().split()]
    ##be = [0]*M
    ##ki = [0]*M
    aru = [0]*(N+1)
    for i in range(M):
        b, k = [int(i) for i in stdin.readline().split()]
        aru[b] += 1
        aru[k] -= 1
    ##print(aru)
    adb = [0]*(N+1)
    db = 0
    if aru[1] == 0:
        db = 1
    for i in range(1,N):
        adb[i] = adb[i-1] + aru[i]
        if adb[i] == 0 and aru[i] < 0:
            db += 1
    ##print(adb)
    print(db)

main()
SubtaskSumTestVerdictTimeMemory
base35/50
1Accepted0/017ms11100 KiB
2Time limit exceeded0/0372ms19544 KiB
3Accepted2/217ms11536 KiB
4Accepted2/217ms11656 KiB
5Accepted2/217ms12240 KiB
6Accepted2/217ms11940 KiB
7Accepted2/217ms12400 KiB
8Accepted2/217ms12460 KiB
9Accepted2/217ms12464 KiB
10Accepted2/217ms12784 KiB
11Accepted2/234ms14428 KiB
12Accepted2/243ms15752 KiB
13Accepted3/346ms15724 KiB
14Accepted3/371ms18400 KiB
15Accepted3/370ms18516 KiB
16Runtime error0/3215ms67400 KiB
17Runtime error0/3218ms67132 KiB
18Runtime error0/3231ms67388 KiB
19Accepted3/3120ms25304 KiB
20Accepted3/3145ms28600 KiB
21Time limit exceeded0/3354ms21540 KiB
22Time limit exceeded0/3363ms21488 KiB