238622026-01-31 10:06:23BoldizsárKert (75 pont)cpp17Részben helyes 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 = 0;
        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;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base67/75
1Elfogadva0/01ms316 KiB
2Elfogadva0/089ms316 KiB
3Részben helyes2/41ms316 KiB
4Elfogadva4/41ms500 KiB
5Részben helyes2/41ms316 KiB
6Részben helyes2/41ms384 KiB
7Részben helyes2/41ms344 KiB
8Elfogadva4/41ms316 KiB
9Elfogadva4/41ms316 KiB
10Elfogadva4/42ms316 KiB
11Elfogadva6/62ms316 KiB
12Elfogadva6/64ms508 KiB
13Elfogadva6/610ms512 KiB
14Elfogadva6/686ms316 KiB
15Elfogadva6/685ms1088 KiB
16Elfogadva6/693ms496 KiB
17Elfogadva7/746ms316 KiB