79022024-01-11 19:22:51AblablablaÉrdekes túra (70 pont)cpp17Accepted 70/7032ms7992 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> magassag(n + 1);

    for(int i = 0; i < n; i++){
        cin >> magassag[i];
    }

    magassag[n] = magassag[n - 1];

    int db = 0;
    int maxi = -1;
    int kezdes = 0;

    for(int i = 1; i <= n; i++){
        if(magassag[i] == magassag[i - 1]){
            int hossz = i - kezdes;

            if(hossz >= 2){
                db++;
                maxi = max(maxi, hossz);
            }

            kezdes = i;
        }
    }

    cout << db << "\n" << maxi << "\n";
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1808 KiB
2Accepted0/028ms3100 KiB
3Accepted3/33ms2600 KiB
4Accepted3/32ms2688 KiB
5Accepted3/33ms2816 KiB
6Accepted3/32ms2908 KiB
7Accepted3/33ms2916 KiB
8Accepted3/32ms2912 KiB
9Accepted3/33ms2936 KiB
10Accepted3/33ms3064 KiB
11Accepted3/33ms3276 KiB
12Accepted3/33ms3372 KiB
13Accepted4/44ms3684 KiB
14Accepted4/417ms4328 KiB
15Accepted4/420ms4752 KiB
16Accepted4/420ms4952 KiB
17Accepted4/421ms5216 KiB
18Accepted4/423ms5780 KiB
19Accepted4/429ms6724 KiB
20Accepted4/428ms7368 KiB
21Accepted4/432ms7960 KiB
22Accepted4/425ms7992 KiB