254792026-02-20 11:48:00VizsimiKert (75 pont)python3Time limit exceeded 57/75579ms18760 KiB
a = input().split()
lines = int(a[0])
N = int(a[1])
colors = int(a[2])


majority = 0
highest = 1
for i in range(lines):
    current = 1
    count = {

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

    for j in range(N):
        if flowers[j] not in count:
           count[flowers[j]] = 0
        count[flowers[j]] += 1
        if count[flowers[j]] > N/2:
            majority += 1
            break
    for j in range(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/016ms3312 KiB
2Time limit exceeded0/0540ms5636 KiB
3Accepted4/416ms3340 KiB
4Accepted4/416ms3120 KiB
5Accepted4/416ms2916 KiB
6Accepted4/416ms2976 KiB
7Accepted4/417ms3088 KiB
8Accepted4/417ms3124 KiB
9Accepted4/417ms2972 KiB
10Accepted4/427ms3300 KiB
11Accepted6/617ms3124 KiB
12Accepted6/639ms3440 KiB
13Accepted6/686ms3588 KiB
14Time limit exceeded0/6531ms4132 KiB
15Time limit exceeded0/6564ms18760 KiB
16Time limit exceeded0/6579ms5548 KiB
17Accepted7/7291ms4248 KiB