59612023-10-06 19:39:30mmatedÉrdekes túra (70 pont)cpp17Accepted 70/7012ms5008 KiB
#include <bits/stdc++.h>
using namespace std;
#define f(i,k,n) for(int i=k; i<n; i++)
#define ll long long
const int inf = INT_MAX;

void solve()
{
    int n;
    cin>>n;
    int a[n+1];
    f(i,0,n)    cin>>a[i];  
    a[n]=a[n-1];
    int i=0;
    int b=1;
    vector<int> c;
    while(i<n)
    {
        if(a[i]!=a[i+1])   b++;
        if(a[i]==a[i+1])
        {
            if(b>1) c.push_back(b);
            b=1;
        }
        i++;
    }
    if(c.size()==0)
    {
        cout<<0<<"\n"<<-1<<"\n";
        return;
    }
    int maxi=0;
    for(auto x : c) maxi=max(maxi,x);
    cout<<c.size()<<"\n"<<maxi<<"\n";
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1700 KiB
2Accepted0/012ms2704 KiB
3Accepted3/33ms2140 KiB
4Accepted3/32ms2500 KiB
5Accepted3/33ms2676 KiB
6Accepted3/33ms2816 KiB
7Accepted3/33ms3052 KiB
8Accepted3/33ms3240 KiB
9Accepted3/33ms3348 KiB
10Accepted3/33ms3460 KiB
11Accepted3/33ms3588 KiB
12Accepted3/33ms3692 KiB
13Accepted4/43ms3696 KiB
14Accepted4/47ms4128 KiB
15Accepted4/48ms4296 KiB
16Accepted4/48ms4336 KiB
17Accepted4/48ms4444 KiB
18Accepted4/49ms4756 KiB
19Accepted4/410ms4880 KiB
20Accepted4/410ms5008 KiB
21Accepted4/412ms5000 KiB
22Accepted4/49ms4956 KiB