30672023-02-12 19:44:57xxxKert (75 pont)cpp14Elfogadva 75/75239ms13156 KiB
#include <bits/stdc++.h>
#include <vector>
using namespace std;

#define int long long
#define fr(n) for(int i =0; i<n; i++)
#define frj(n) for(int j =0; j<n; j++)

signed main() {
    int m, n, p, x;
    cin >> m >> n >> p;
    vector<vector<int>> a;
    a.resize(m, vector<int>(n));
    int temp = 0, cnt = 0, max = 0, ans = 0;
    fr(m) {
        cnt = 0;
        temp = 0;
        frj(n) {
            cin >> a[i][j];
            if (a[i][j] == temp)
                cnt++;
            else {
                temp = a[i][j];
                cnt = 1;
            }
            if (cnt > max) {
            max = cnt;
        }
        }

    }

    int ans2 = 0;
    for (int i = 0; i < m; i++) {
        sort(a[i].begin(), a[i].end());
        bool b = false;
        temp = 0;
        cnt = 0;
        for (int j = 0; j < n; j++) {
            if (a[i][j] == temp) {
                cnt++;
            }
            else {
                temp = a[i][j];
                cnt = 1;
            }
            if (cnt > n / 2) {
                b = true;
            }
        }
        if (b) ans2++;
    }

    cout << ans2 << endl << max;

    return 0;

}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base75/75
1Elfogadva0/03ms1816 KiB
2Elfogadva0/0224ms9772 KiB
3Elfogadva4/43ms2144 KiB
4Elfogadva4/43ms2344 KiB
5Elfogadva4/43ms2540 KiB
6Elfogadva4/43ms2788 KiB
7Elfogadva4/43ms2848 KiB
8Elfogadva4/43ms2984 KiB
9Elfogadva4/43ms3068 KiB
10Elfogadva4/46ms3152 KiB
11Elfogadva6/63ms3208 KiB
12Elfogadva6/610ms3792 KiB
13Elfogadva6/627ms4188 KiB
14Elfogadva6/6209ms11332 KiB
15Elfogadva6/6209ms13156 KiB
16Elfogadva6/6239ms11808 KiB
17Elfogadva7/7122ms8012 KiB