254912026-02-20 12:11:34VizsimiKert (75 pont)python3Time limit exceeded 44/75595ms14728 KiB
a = input().split()
lines = int(a[0])
N = int(a[1])
colors = int(a[2])

current = 1
majority = 0
highest = 1


for i in range(lines):
    state = True
    count = {

    }
    flowers = [int(x) for x in input().split()]
    flowers.append(0)

    for j in range(N):
        if state:
            if flowers[j] not in count:
                count[flowers[j]] = 0
            count[flowers[j]] += 1
            if max(count.values())*2 > N:
                majority += 1
                state = False
        if flowers[j] == flowers[j+1]:
            current += 1
        else:
            if current > highest:
                highest = current
            current = 1
print(majority)
print(highest)
SubtaskSumTestVerdictTimeMemory
base44/75
1Accepted0/017ms3312 KiB
2Time limit exceeded0/0584ms5368 KiB
3Accepted4/417ms3124 KiB
4Accepted4/417ms3124 KiB
5Accepted4/416ms3320 KiB
6Accepted4/417ms3312 KiB
7Accepted4/417ms3116 KiB
8Accepted4/417ms3068 KiB
9Accepted4/417ms3124 KiB
10Accepted4/482ms3356 KiB
11Accepted6/620ms3192 KiB
12Accepted6/6151ms3340 KiB
13Time limit exceeded0/6586ms3636 KiB
14Time limit exceeded0/6579ms3892 KiB
15Time limit exceeded0/6591ms14728 KiB
16Time limit exceeded0/6595ms5428 KiB
17Time limit exceeded0/7583ms4000 KiB