206242026-01-08 08:09:13sklausSíkság (55)cpp17Wrong answer 21/55300ms760 KiB
#include <iostream>


using namespace std;

int main()
{
    int n;
    cin>>n;
    int t[n];
    for(int i=0; i<n-1; i++)
    {
        cin>>t[i];
    }
    int maxi=1;
    int k, l, j;
    int e;
    for(int i=0; i<n; i++)
    {
        int x=1;
        j=i;
        k=t[j];
        while(t[j]==t[j+1])
        {
            x++;
            j++;
        }
        j++;
        l=t[j];
        if(l-k==1 or k-l==1){
        while(t[j]==l or t[j]==k){x++;j++;}
        }
            if(x>maxi)
            {
                maxi=x;
                e=i+1;
            }
    }
    cout << maxi << " " << e;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base21/55
1Accepted0/01ms316 KiB
2Accepted0/012ms500 KiB
3Wrong answer0/21ms508 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted3/31ms316 KiB
8Accepted2/21ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/39ms424 KiB
11Accepted3/33ms332 KiB
12Time limit exceeded0/3212ms428 KiB
13Accepted3/334ms744 KiB
14Time limit exceeded0/3300ms664 KiB
15Time limit exceeded0/3300ms564 KiB
16Time limit exceeded0/3275ms564 KiB
17Time limit exceeded0/3279ms760 KiB
18Time limit exceeded0/3259ms564 KiB
19Time limit exceeded0/3300ms564 KiB
20Time limit exceeded0/3300ms524 KiB
21Time limit exceeded0/3282ms564 KiB
22Time limit exceeded0/3284ms564 KiB