254942026-02-20 12:14:43VizsimiKert (75 pont)python3Time limit exceeded 57/75583ms19448 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 count[flowers[j]]*2 > N:
                majority += 1
                state = False
        if highest < N:
            if flowers[j] == flowers[j+1]:
                current += 1
            else:
                if current > highest:
                    highest = current
                current = 1
print(majority)
print(highest)
SubtaskSumTestVerdictTimeMemory
base57/75
1Accepted0/016ms3124 KiB
2Time limit exceeded0/0583ms5552 KiB
3Accepted4/416ms3116 KiB
4Accepted4/417ms3124 KiB
5Accepted4/416ms3144 KiB
6Accepted4/416ms3124 KiB
7Accepted4/416ms3036 KiB
8Accepted4/417ms3312 KiB
9Accepted4/417ms3320 KiB
10Accepted4/428ms3380 KiB
11Accepted6/617ms3148 KiB
12Accepted6/637ms3300 KiB
13Accepted6/679ms3692 KiB
14Time limit exceeded0/6551ms4052 KiB
15Time limit exceeded0/6556ms19448 KiB
16Time limit exceeded0/6504ms5564 KiB
17Accepted7/7287ms4256 KiB