43702023-03-27 10:33:59DohajovDanielLeghosszabb béke (75 pont)python3Time limit exceeded 0/75273ms16744 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
            ujkezd=False
            ujveg=True
        if hakt>0 and ujveg==True :
            veg=i+1
            ujkezd=True
            ujveg=False
            if mxido<veg-kezd:
                mxk=i
                mxido=veg-kezd
    print(mxido-2,mxk-8)
        
main()
SubtaskSumTestVerdictTimeMemory
base0/75
1Accepted0/017ms11008 KiB
2Time limit exceeded0/0259ms5592 KiB
3Wrong answer0/317ms11496 KiB
4Wrong answer0/317ms11764 KiB
5Wrong answer0/317ms12128 KiB
6Wrong answer0/317ms12336 KiB
7Wrong answer0/317ms12240 KiB
8Wrong answer0/417ms12104 KiB
9Wrong answer0/418ms12708 KiB
10Wrong answer0/420ms12980 KiB
11Wrong answer0/434ms13156 KiB
12Wrong answer0/441ms13464 KiB
13Wrong answer0/434ms13440 KiB
14Wrong answer0/435ms13580 KiB
15Wrong answer0/441ms13548 KiB
16Wrong answer0/443ms13800 KiB
17Wrong answer0/446ms14308 KiB
18Wrong answer0/450ms14600 KiB
19Time limit exceeded0/4252ms7464 KiB
20Time limit exceeded0/4257ms7696 KiB
21Time limit exceeded0/4250ms7688 KiB
22Time limit exceeded0/4273ms16744 KiB