43722023-03-27 10:38:05DohajovDanielLeghosszabb béke (75 pont)python3Time limit exceeded 15/75273ms16540 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 ujveg==False: i+=1
        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/017ms11068 KiB
2Time limit exceeded0/0270ms5444 KiB
3Wrong answer0/317ms11240 KiB
4Wrong answer0/317ms11720 KiB
5Wrong answer0/317ms11756 KiB
6Accepted3/317ms11756 KiB
7Wrong answer0/317ms11828 KiB
8Wrong answer0/417ms12092 KiB
9Wrong answer0/418ms12612 KiB
10Wrong answer0/421ms12772 KiB
11Wrong answer0/435ms12980 KiB
12Wrong answer0/441ms13244 KiB
13Wrong answer0/435ms13468 KiB
14Wrong answer0/437ms13536 KiB
15Wrong answer0/443ms13736 KiB
16Accepted4/446ms13956 KiB
17Accepted4/450ms14412 KiB
18Accepted4/456ms15040 KiB
19Time limit exceeded0/4266ms16540 KiB
20Time limit exceeded0/4261ms7844 KiB
21Time limit exceeded0/4238ms7920 KiB
22Time limit exceeded0/4273ms7944 KiB