152472025-02-17 17:25:21TakacsAndrasKert (75 pont)cpp17Accepted 75/75259ms2612 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int m,n,p; cin >> m >> n >> p;
    vector<vector<int>> a(m,vector<int>(n));
    int out1 = 0, out2 = 0;
    for (int i = 0; i < m; i++) {
        int cnt = 1;
        map<int,int> b;
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
            if (j > 0 && a[i][j] == a[i][j-1]) cnt++;
            else cnt = 1;
            if (++b[a[i][j]] >= n/2+1) {
                out1++;
                b[a[i][j]] = -1;
            }
            out2 = max(out2,cnt);
        }
    }
    cout << out1 << '\n' << out2;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms316 KiB
2Accepted0/0244ms2356 KiB
3Accepted4/41ms316 KiB
4Accepted4/41ms316 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms316 KiB
7Accepted4/41ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/41ms316 KiB
10Accepted4/44ms464 KiB
11Accepted6/62ms420 KiB
12Accepted6/610ms492 KiB
13Accepted6/630ms748 KiB
14Accepted6/6231ms2408 KiB
15Accepted6/6222ms2612 KiB
16Accepted6/6259ms2400 KiB
17Accepted7/7145ms1332 KiB