31772023-02-21 13:58:38PallanekPéterÁruszállítás (75 pont)python3Accepted 75/75250ms28984 KiB
from sys import stdin, stdout
def main():
    n,m=[int(i) for i in input().split()]
    valt=[0]*n
    for i in range(m):
        ab = stdin.readline().split()
        a,b = int(ab[0]), int(ab[1]) 
        valt[a-1]+=1
        valt[b-1]-=1
    arudb=0; ki=0
    for i in range(n-1):
        arudb+=valt[i]
        if arudb==0:
            ki+=1
    print(ki)
main()
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms11188 KiB
2Accepted0/0239ms26932 KiB
3Accepted3/317ms11240 KiB
4Accepted3/317ms11664 KiB
5Accepted3/317ms11884 KiB
6Accepted3/317ms11884 KiB
7Accepted3/317ms11856 KiB
8Accepted4/417ms12092 KiB
9Accepted4/417ms12272 KiB
10Accepted4/417ms12188 KiB
11Accepted4/426ms13056 KiB
12Accepted4/432ms13940 KiB
13Accepted4/435ms13816 KiB
14Accepted4/450ms15668 KiB
15Accepted4/446ms15636 KiB
16Accepted4/461ms17284 KiB
17Accepted4/475ms18956 KiB
18Accepted4/489ms20844 KiB
19Accepted4/472ms19332 KiB
20Accepted4/487ms20888 KiB
21Accepted4/4243ms28656 KiB
22Accepted4/4250ms28984 KiB