43582023-03-26 22:21:09PallanekPéterLeghosszabb béke (75 pont)python3Time limit exceeded 44/75263ms14760 KiB
N,M=[int(i) for i in input().split()]
napok=[0]*N
for i in range(M):
        a,b=[int(i) for i in input().split()]
        napok[a-1]+=1
        napok[b]-=1

db=0; mx=0; nap=0; Lnap=0; ossz=0
for i in range(N):
        ossz+=napok[i]
        if ossz==0:
            db+=1
        else:
            if db>mx:
                mx=db
                Lnap=nap
            nap=i+1
            db=0
if db>mx:
        mx=db
        Lnap=nap
if mx==0:
    print(-1)
else:
    print(mx,Lnap+1)
SubtaskSumTestVerdictTimeMemory
base44/75
1Accepted0/017ms11148 KiB
2Time limit exceeded0/0263ms13004 KiB
3Runtime error0/317ms11560 KiB
4Accepted3/317ms11756 KiB
5Accepted3/317ms12084 KiB
6Accepted3/317ms12416 KiB
7Accepted3/317ms12164 KiB
8Accepted4/417ms12284 KiB
9Accepted4/418ms12724 KiB
10Accepted4/420ms12964 KiB
11Accepted4/432ms13104 KiB
12Accepted4/441ms13040 KiB
13Accepted4/434ms13172 KiB
14Accepted4/435ms13476 KiB
15Accepted4/439ms13332 KiB
16Runtime error0/417ms13432 KiB
17Runtime error0/417ms13756 KiB
18Runtime error0/418ms14196 KiB
19Time limit exceeded0/4244ms14660 KiB
20Runtime error0/417ms14628 KiB
21Runtime error0/417ms14760 KiB
22Runtime error0/417ms14752 KiB