56292023-08-29 12:45:19TomaSajtKert (75 pont)cpp17Accepted 75/7598ms22612 KiB
#include <bits/stdc++.h>
using namespace std;

int solve(const vector<int>& v) {
  int best = 1;
  int curr = 1;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] != v[i - 1]) curr = 0;
    curr++;
    best = max(best, curr);
  }
  return best;
}

int main() {
  cin.tie(0), ios::sync_with_stdio(0);

  int m, n, p;
  cin >> m >> n >> p;

  int sol1 = 0, sol2 = 0;
  while (m--) {
    vector<int> v(n);
    for (int& a : v) cin >> a;
    sol2 = max(sol2, solve(v));
    sort(v.begin(), v.end());
    if (solve(v) > n / 2) sol1++;
  }

  cout << sol1 << '\n';
  cout << sol2;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1824 KiB
2Accepted0/096ms6076 KiB
3Accepted4/43ms6180 KiB
4Accepted4/43ms6396 KiB
5Accepted4/43ms6604 KiB
6Accepted4/43ms6828 KiB
7Accepted4/43ms7060 KiB
8Accepted4/43ms7116 KiB
9Accepted4/43ms7460 KiB
10Accepted4/44ms7696 KiB
11Accepted6/63ms7984 KiB
12Accepted6/66ms8096 KiB
13Accepted6/613ms8664 KiB
14Accepted6/692ms12120 KiB
15Accepted6/690ms16268 KiB
16Accepted6/698ms20184 KiB
17Accepted7/750ms22612 KiB