238602026-01-31 09:58:51BoldizsárKert (75 pont)cpp17Partially correct 67/7593ms1088 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
	int m,n,p;cin >> m >> n >> p;
    vector<int>szinek(n);
    bool before = false;int cnt = 0,ans = 1,current = 1,prev = -1;
    for(int i = 1;i <= m;i++){
        for(int j = 0;j < n;j++){
            cin >> szinek[j];
            if(szinek[j] == prev){
                current++;
            }else{
                current = 1;
                prev = szinek[j];
            }
            ans = max(ans,current);
        }
        sort(szinek.begin(),szinek.end());
        szinek.push_back(-1);
        prev = -1;current = 1;
        for(int j = 0;j <= n;j++){
            if(szinek[j] == prev){
                current++;
            }else{
                if(current > n/2) cnt++;
                current = 1;
                prev = szinek[j];
            }
            
        }
        current = 1;
    }
    cout <<cnt<<"\n"<<ans;
}
SubtaskSumTestVerdictTimeMemory
base67/75
1Accepted0/02ms316 KiB
2Accepted0/090ms316 KiB
3Partially correct2/41ms316 KiB
4Accepted4/41ms316 KiB
5Partially correct2/41ms316 KiB
6Partially correct2/41ms384 KiB
7Partially correct2/41ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/41ms316 KiB
10Accepted4/42ms552 KiB
11Accepted6/61ms316 KiB
12Accepted6/64ms500 KiB
13Accepted6/610ms444 KiB
14Accepted6/686ms316 KiB
15Accepted6/685ms1088 KiB
16Accepted6/693ms316 KiB
17Accepted7/746ms316 KiB