16322022-11-30 18:17:07bzsofiaSíkság (55)cpp11Wrong answer 26/55277ms4712 KiB
#include <iostream>
#include <vector>

using namespace std;

long long i, n, j, maxtav, maxi, minsz, maxsz;

int main()
{
    cin>>n;

    vector <long long> x(n+1);

    for (i=1; i<=n; ++i) cin>>x[i];

    for (i=1; i<n; ++i)
    {
        maxsz=x[i];
        minsz=x[i];
        for (j=i+1; j<=n; ++j)
        {
            if (x[j]>maxsz) maxsz=x[j];
            if (x[j]<minsz) minsz=x[j];
            if (maxsz-minsz>1)
            {
                if (j-i>maxtav)
                {
                    maxtav=j-i;
                    maxi=i;
                }
                break;
            }
        }
    }

    cout<<maxtav<<" "<<maxi;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base26/55
1Accepted0/03ms1968 KiB
2Accepted0/012ms2316 KiB
3Wrong answer0/22ms2316 KiB
4Accepted2/22ms2424 KiB
5Accepted2/22ms2840 KiB
6Accepted2/22ms2884 KiB
7Accepted3/32ms2976 KiB
8Accepted2/23ms3180 KiB
9Accepted3/33ms3304 KiB
10Accepted3/312ms3428 KiB
11Accepted3/34ms3432 KiB
12Wrong answer0/370ms3428 KiB
13Accepted3/332ms4712 KiB
14Time limit exceeded0/3275ms3420 KiB
15Time limit exceeded0/3277ms3712 KiB
16Time limit exceeded0/3268ms3756 KiB
17Time limit exceeded0/3277ms3708 KiB
18Time limit exceeded0/3261ms3976 KiB
19Time limit exceeded0/3246ms3832 KiB
20Time limit exceeded0/3256ms3868 KiB
21Accepted3/3109ms4592 KiB
22Time limit exceeded0/3263ms3732 KiB