9622022-02-05 17:27:58Kevinke12Kert (75 pont)cpp14Runtime error 0/751ms1260 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll N, M, P;
ll t[105][50000];

int main()
{
    cin >> N >> M >> P;
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < M;j++)
            cin >> t[i][j];
    }

    //1. subtask
    int ans1=0;
    for(int i = 0; i < N; i++)
    {
        map<ll, int> m;
        for(int j = 0;j < M; j++)
            m[t[i][j]]++;
        int mDb=0;
        for(auto aktErt:m)
        {
            mDb = max(mDb, aktErt.second);
        }
        if(mDb>M-mDb)
            ans1++;
    }

    //2. subtask
    int ans2=0;
    for(int i = 0; i < N; i++)
    {
        int aktDb=1;
        for(int j = 1;j < M; j++)
        {
            if(t[i][j-1]==t[i][j])
                aktDb++;
            else
            {
                ans2 = max(ans2, aktDb);
                aktDb=1;

            }
        }
    }

    cout << ans1 << "\n";
    cout << ans2 << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Runtime error0/01ms1168 KiB
2Runtime error0/01ms1208 KiB
3Runtime error0/41ms1192 KiB
4Runtime error0/41ms1256 KiB
5Runtime error0/41ms1132 KiB
6Runtime error0/41ms1256 KiB
7Runtime error0/41ms1128 KiB
8Runtime error0/41ms1256 KiB
9Runtime error0/41ms1256 KiB
10Runtime error0/41ms1196 KiB
11Runtime error0/61ms1192 KiB
12Runtime error0/61ms1260 KiB
13Runtime error0/61ms1160 KiB
14Runtime error0/61ms1244 KiB
15Runtime error0/61ms1256 KiB
16Runtime error0/61ms1256 KiB
17Runtime error0/71ms1256 KiB