43712023-03-27 10:36:39DohajovDanielLeghosszabb béke (75 pont)python3Time limit exceeded 15/75259ms16720 KiB
def main():
    nap,hdb=[int(i) for i in input().split()]
    hkezd=nap*[0]
    hveg=nap*[0]
    for i in range(hdb):
        be=[int(i) for i in input().split()]
        hveg[max(be)-1]+=1
        hkezd[min(be)-1]+=1
    hakt=0
    kezd=0;veg=0
    ujkezd=True;ujveg=True
    mxido=0;mxk=0
    for i in range(nap):
        hakt+=hkezd[i]
        hakt-=hveg[i]
        if hakt==0 and ujkezd==True:
            kezd=i+1
            ujkezd=False
            ujveg=True
        if hakt>0 and ujveg==True :
            veg=i+1
            ujkezd=True
            ujveg=False
            if mxido<veg-kezd:
                mxk=kezd+1
                mxido=veg-kezd-1
    print(mxido,mxk)
        
main()
SubtaskSumTestVerdictTimeMemory
base15/75
1Accepted0/018ms11128 KiB
2Time limit exceeded0/0259ms5508 KiB
3Wrong answer0/317ms11416 KiB
4Wrong answer0/317ms11912 KiB
5Wrong answer0/317ms12164 KiB
6Accepted3/317ms12276 KiB
7Wrong answer0/317ms12556 KiB
8Wrong answer0/417ms12136 KiB
9Wrong answer0/418ms12780 KiB
10Wrong answer0/420ms12848 KiB
11Wrong answer0/434ms12916 KiB
12Wrong answer0/441ms13472 KiB
13Wrong answer0/432ms13320 KiB
14Wrong answer0/435ms13216 KiB
15Wrong answer0/441ms13324 KiB
16Accepted4/443ms14052 KiB
17Accepted4/446ms14284 KiB
18Accepted4/452ms14988 KiB
19Time limit exceeded0/4256ms16624 KiB
20Time limit exceeded0/4256ms7792 KiB
21Time limit exceeded0/4224ms7940 KiB
22Time limit exceeded0/4259ms16720 KiB