243912026-02-10 21:29:45mzperxLeghosszabb béke (75 pont)python3Time limit exceeded 3/75287ms7876 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

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
base3/75
1Accepted0/017ms3252 KiB
2Time limit exceeded0/0287ms7664 KiB
3Runtime error0/316ms3100 KiB
4Accepted3/316ms3124 KiB
5Wrong answer0/316ms3156 KiB
6Wrong answer0/317ms3080 KiB
7Wrong answer0/316ms3040 KiB
8Wrong answer0/417ms3068 KiB
9Wrong answer0/418ms3124 KiB
10Wrong answer0/419ms3132 KiB
11Wrong answer0/434ms3520 KiB
12Wrong answer0/441ms3840 KiB
13Wrong answer0/437ms3820 KiB
14Wrong answer0/437ms3892 KiB
15Wrong answer0/441ms3828 KiB
16Runtime error0/416ms3392 KiB
17Runtime error0/417ms3232 KiB
18Runtime error0/417ms3572 KiB
19Time limit exceeded0/4256ms7876 KiB
20Runtime error0/417ms3896 KiB
21Runtime error0/418ms3756 KiB
22Runtime error0/417ms3892 KiB