153362025-02-18 13:51:04MezeiDavidKert (75 pont)cpp17Accepted 75/75250ms2612 KiB

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m, p;cin>>n>>m>>p;
    vector<vector<int>> a(n, vector<int> (m, 0));
    int maxi=1;
    int semaxi=0;
    int y=0;
    int ans=0;
    map<int, int> mape;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            int x;cin>>x;
            x--;
            mape[x]++;
            if(j!=0){
                if(y==x){
                    semaxi++;
                }else{
                    maxi=max(semaxi, maxi);
                    semaxi=1;
                }
            }
            y=x;
        }
        maxi=max(maxi, semaxi);
        semaxi=1;
        int hh=0;
        for(pair<int, int> j: mape){
            hh=max(hh, j.second);
        }
        if(hh>m/2){
            ans++;
        }
        mape.clear();
    }
    cout<<ans<<'\n'<<maxi<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms316 KiB
2Accepted0/0236ms2356 KiB
3Accepted4/41ms316 KiB
4Accepted4/41ms316 KiB
5Accepted4/41ms540 KiB
6Accepted4/41ms316 KiB
7Accepted4/41ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/41ms328 KiB
10Accepted4/44ms316 KiB
11Accepted6/62ms316 KiB
12Accepted6/69ms508 KiB
13Accepted6/629ms712 KiB
14Accepted6/6225ms2356 KiB
15Accepted6/6214ms2612 KiB
16Accepted6/6250ms2356 KiB
17Accepted7/7143ms1332 KiB