238302026-01-30 15:16:18BoldizsárKert (75 pont)cpp17Runtime error 44/7532ms32000 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(p);
    vector<int>volt(p);
    bool before = false;int cnt = 0,ans = 1,current = 1,prev = -1;
    for(int i = 1;i <= m;i++){
        for(int j = 1;j <= n;j++){
            int temp;cin >> temp;
            szinek[temp]++;
            if(szinek[temp]-volt[temp]>n/2){
                before = true;
            }
            if(temp == prev && j != 1){
                current++;
            }else{
                prev = temp;
                current = 1;
            }
            ans = max(ans,current);
        }
        if(before){
            cnt++;before = false;
        }
        volt = szinek;
        
    }
    cout <<cnt<<"\n"<<ans;
}
SubtaskSumTestVerdictTimeMemory
base44/75
1Accepted0/01ms316 KiB
2Runtime error0/032ms32000 KiB
3Accepted4/41ms316 KiB
4Accepted4/41ms316 KiB
5Accepted4/42ms1076 KiB
6Accepted4/42ms1076 KiB
7Accepted4/42ms1080 KiB
8Accepted4/42ms1080 KiB
9Accepted4/42ms1076 KiB
10Accepted4/43ms1076 KiB
11Accepted6/62ms1076 KiB
12Accepted6/623ms8120 KiB
13Runtime error0/628ms32000 KiB
14Runtime error0/628ms32000 KiB
15Runtime error0/628ms32000 KiB
16Runtime error0/632ms32000 KiB
17Runtime error0/732ms32000 KiB