244682026-02-12 00:10:28mzperxLeghosszabb béke (75 pont)python3Time limit exceeded 44/75273ms8988 KiB
hossz, db = [int(x) for x in input().split()]
évek = [0] * (hossz+1)
for _ in range(db):
    kezdet, vég = [int(x) for x in input().split()]
    évek[kezdet] += 1
    évek[vég+1] -= 1
# print(évek)
'''
évek = [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 
-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1, 0, -1, 0, 0]
'''
évek.append(1)
stat = [0] * len(évek)
mutató = 0
for i in range(len(évek)):
    mutató += évek[i]
    if mutató > 0:
        stat[i] = mutató

eredmény =  [0] * len(évek)
for i in range(1, len(évek)):
    if stat[i] == 0:
        eredmény[i] = eredmény[i-1] + 1
    else:
        eredmény[i] = 0
maximum = max(eredmény)
hol = eredmény.index(maximum)


#print(stat)
#print(eredmény)
if maximum == 0:
    print(-1)
else:
    print(maximum, hol-maximum+1)
SubtaskSumTestVerdictTimeMemory
base44/75
1Accepted0/016ms3124 KiB
2Time limit exceeded0/0273ms8988 KiB
3Runtime error0/317ms3124 KiB
4Accepted3/316ms3124 KiB
5Accepted3/317ms3100 KiB
6Accepted3/316ms3152 KiB
7Accepted3/316ms2984 KiB
8Accepted4/416ms3136 KiB
9Accepted4/418ms3140 KiB
10Accepted4/421ms3376 KiB
11Accepted4/434ms3588 KiB
12Accepted4/443ms3892 KiB
13Accepted4/435ms3976 KiB
14Accepted4/437ms3904 KiB
15Accepted4/441ms3892 KiB
16Runtime error0/416ms3156 KiB
17Runtime error0/416ms3464 KiB
18Runtime error0/417ms3380 KiB
19Time limit exceeded0/4261ms8500 KiB
20Runtime error0/417ms3752 KiB
21Runtime error0/418ms3784 KiB
22Runtime error0/417ms3740 KiB