208322026-01-09 17:23:37PappMatyasSíkság (55)cpp17Wrong answer 0/5532ms508 KiB
#include<iostream>
#include<math.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int max = 0;
    int s = -1;
    int current = 0;
    int cIndex = -1;
    int x, lx;
    cin >> lx;
    for(int i = 0; i < n - 1; i++)
    {
        cin >> x;
        if(abs(lx - x) <= 1)
        {
            if(current == 0)
            {
                cIndex = i;
            }
            current++;
        }
        else
        {
            if(current > max)
            {
                max = current;
                s = cIndex;
            }
            current = 0;
        }
        lx = x;
    }
    if(current > max)
    {
        max = current;
        s = cIndex;
    }
    cout << s + 1 << " " << max;
}
SubtaskSumTestVerdictTimeMemory
base0/55
1Accepted0/01ms316 KiB
2Wrong answer0/03ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms508 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/34ms316 KiB
11Wrong answer0/33ms396 KiB
12Wrong answer0/33ms316 KiB
13Wrong answer0/329ms396 KiB
14Wrong answer0/317ms400 KiB
15Wrong answer0/325ms400 KiB
16Wrong answer0/330ms400 KiB
17Wrong answer0/332ms400 KiB
18Wrong answer0/332ms400 KiB
19Wrong answer0/332ms396 KiB
20Wrong answer0/332ms404 KiB
21Wrong answer0/316ms316 KiB
22Wrong answer0/325ms400 KiB