116932024-11-05 15:37:02farkasrekaLeghosszabb béke (75 pont)pypy3Time limit exceeded 6/75303ms22980 KiB
from sys import stdin

N, M = [int(x) for x in stdin.readline().split()]

haboruk = [0 for x in range(N)]
for _ in range(M):
	elso, utolso = [int(x) for x in stdin.readline().split()]
	for i in range(elso-1, utolso):
		haboruk[i] += 2
szeria = 0
max_szeria = -1
for j in range(N):
	most = haboruk[j]
	if most == 0:
		szeria += 1
	if most != 0:
		if szeria > max_szeria:
			max_szeria = szeria
			eleje = j-szeria
		szeria = 0
print(max_szeria, eleje+1)
SubtaskSumTestVerdictTimeMemory
base6/75
1Accepted0/045ms19608 KiB
2Time limit exceeded0/0287ms22856 KiB
3Wrong answer0/341ms19392 KiB
4Accepted3/343ms19564 KiB
5Wrong answer0/339ms19440 KiB
6Accepted3/343ms19376 KiB
7Wrong answer0/339ms19440 KiB
8Wrong answer0/446ms19584 KiB
9Wrong answer0/450ms21548 KiB
10Wrong answer0/454ms21736 KiB
11Wrong answer0/479ms22252 KiB
12Wrong answer0/4101ms21996 KiB
13Wrong answer0/481ms21996 KiB
14Wrong answer0/4104ms21996 KiB
15Wrong answer0/4111ms22080 KiB
16Time limit exceeded0/4300ms22248 KiB
17Time limit exceeded0/4301ms22324 KiB
18Time limit exceeded0/4284ms22204 KiB
19Time limit exceeded0/4303ms22980 KiB
20Time limit exceeded0/4280ms22736 KiB
21Time limit exceeded0/4303ms22648 KiB
22Time limit exceeded0/4291ms22764 KiB