9582022-02-05 17:25:05Kevinke12Kert (75 pont)cpp14Runtime error 0/758ms1224 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long

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

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/01ms996 KiB
2Runtime error0/01ms1172 KiB
3Runtime error0/41ms1220 KiB
4Runtime error0/41ms1220 KiB
5Runtime error0/41ms1148 KiB
6Runtime error0/41ms1152 KiB
7Runtime error0/41ms1092 KiB
8Runtime error0/48ms1216 KiB
9Runtime error0/41ms1148 KiB
10Runtime error0/41ms1216 KiB
11Runtime error0/61ms1088 KiB
12Runtime error0/61ms1220 KiB
13Runtime error0/61ms1156 KiB
14Runtime error0/61ms1160 KiB
15Runtime error0/61ms1096 KiB
16Runtime error0/61ms1224 KiB
17Runtime error0/71ms1160 KiB