214122026-01-13 07:44:49KosAKosSíkság (55)cpp17Wrong answer 0/55229ms564 KiB
#include <iostream>

using namespace std;

int n,k,tomb[10000];
int nagyhely,nagysag;

int kereses(int a)
{
    int temp=0;
    for (int i=a;i<=n;i++)
    {
        if (tomb[i]+1 == tomb[i+1] || tomb[i]-1 == tomb[i+1] || tomb[i] == tomb[i+1]) {
            temp++;
        } else return temp;
    }
    return temp;
}


int main()
{
    cin >> n;
    for (int i=1;i<=n;i++)
    {
        cin >> tomb[i];
    }

    for (int i=1;i<=n;i++)
    {
        if (nagysag < kereses(i)) {
            nagysag = kereses(i);
            nagyhely = i;
        }
    }

    cout << nagyhely << " " << nagysag;


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/55
1Accepted0/01ms316 KiB
2Wrong answer0/017ms548 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms512 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/22ms316 KiB
9Wrong answer0/32ms332 KiB
10Wrong answer0/339ms436 KiB
11Wrong answer0/34ms388 KiB
12Time limit exceeded0/3229ms432 KiB
13Wrong answer0/34ms316 KiB
14Wrong answer0/32ms316 KiB
15Wrong answer0/33ms412 KiB
16Runtime error0/34ms316 KiB
17Runtime error0/34ms316 KiB
18Runtime error0/34ms436 KiB
19Runtime error0/34ms316 KiB
20Runtime error0/34ms316 KiB
21Wrong answer0/346ms436 KiB
22Runtime error0/34ms564 KiB