254512026-02-20 10:19:52VizsimiKert (75 pont)python3Time limit exceeded 28/75537ms22676 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):
#     count = [0]*(colors+1)
#     flowers = [int(x) for x in input().split()]
#     flowers.append(0)

#     for j in range(N):
#         count[flowers[j]] += 1
#         if count[flowers[j]] > N/2:
#             majority += 1
#             break
#         if flowers[j] == flowers[j+1]:
#             current += 1
#         else:
#             if current > highest:
#                 highest = current
#                 current = 1
# print(majority)
# print(highest)

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):
    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
        if flowers[j] == flowers[j+1]:
            current += 1
        else:
            if current > highest:
                highest = current
                current = 1
print(majority)
print(highest)
SubtaskSumTestVerdictTimeMemory
base28/75
1Accepted0/016ms3140 KiB
2Time limit exceeded0/0537ms9136 KiB
3Partially correct2/416ms3116 KiB
4Partially correct2/416ms3124 KiB
5Partially correct2/416ms3124 KiB
6Partially correct2/416ms3124 KiB
7Partially correct2/416ms3124 KiB
8Partially correct2/416ms3312 KiB
9Partially correct2/417ms3124 KiB
10Partially correct2/427ms3324 KiB
11Partially correct3/617ms3012 KiB
12Partially correct3/637ms3404 KiB
13Partially correct3/676ms4060 KiB
14Time limit exceeded0/6518ms3964 KiB
15Time limit exceeded0/6510ms22676 KiB
16Time limit exceeded0/6523ms9508 KiB
17Partially correct3/7275ms5872 KiB