116922024-11-05 15:36:34farkasrekaLeghosszabb béke (75 pont)python3Time limit exceeded 6/75300ms3860 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/016ms3308 KiB
2Time limit exceeded0/0282ms3856 KiB
3Wrong answer0/317ms3112 KiB
4Accepted3/316ms3128 KiB
5Wrong answer0/317ms3128 KiB
6Accepted3/317ms3128 KiB
7Wrong answer0/316ms3312 KiB
8Wrong answer0/416ms3144 KiB
9Wrong answer0/421ms2972 KiB
10Wrong answer0/463ms3128 KiB
11Time limit exceeded0/4287ms3384 KiB
12Time limit exceeded0/4300ms3508 KiB
13Time limit exceeded0/4279ms3384 KiB
14Time limit exceeded0/4284ms3340 KiB
15Time limit exceeded0/4289ms3548 KiB
16Time limit exceeded0/4300ms3356 KiB
17Time limit exceeded0/4282ms3456 KiB
18Time limit exceeded0/4289ms3600 KiB
19Time limit exceeded0/4287ms3860 KiB
20Time limit exceeded0/4300ms3856 KiB
21Time limit exceeded0/4279ms3856 KiB
22Time limit exceeded0/4287ms3856 KiB