243942026-02-11 07:33:58mzperxLeghosszabb béke (75 pont)python3Time limit exceeded 34/75272ms7472 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ó

aktmax = [0, 0, 0]
abszmax = [0, 0, 0]
for i in range(1, len(évek)):
    if stat[i] == 0:
        if aktmax[0] == 0:
            aktmax[1] = i
        aktmax[0] += 1
        aktmax[2] = i
    elif aktmax[0] > abszmax[0]:
        abszmax = aktmax[0:3]
        aktmax = [0, 0, 0]
print(abszmax[0], abszmax[1])
SubtaskSumTestVerdictTimeMemory
base34/75
1Accepted0/017ms3140 KiB
2Time limit exceeded0/0272ms7472 KiB
3Runtime error0/317ms3124 KiB
4Accepted3/317ms2948 KiB
5Accepted3/317ms3012 KiB
6Wrong answer0/316ms2948 KiB
7Wrong answer0/316ms3180 KiB
8Wrong answer0/416ms2948 KiB
9Accepted4/418ms3332 KiB
10Accepted4/420ms3284 KiB
11Accepted4/434ms3380 KiB
12Accepted4/441ms3852 KiB
13Accepted4/435ms3752 KiB
14Accepted4/437ms3892 KiB
15Accepted4/441ms3896 KiB
16Runtime error0/417ms3208 KiB
17Runtime error0/417ms3396 KiB
18Runtime error0/417ms3380 KiB
19Time limit exceeded0/4252ms7292 KiB
20Runtime error0/417ms3748 KiB
21Runtime error0/417ms3728 KiB
22Runtime error0/417ms3704 KiB