228542026-01-15 21:29:59FintaTihamerSíkság (55)cpp17Wrong answer 2/55300ms780 KiB
#include <iostream>
#include <fstream>
using namespace std;
struct Volgy{
    int k,v;
    int h;
};
int main()
{   int n;
    fstream f("be.in");
    cin>>n;
    int a[100000];
    for(int i=0; i<n; i++){cin>>a[i];}
    Volgy o;
    o.k=0;
    o.v=0;
    o.h=1;
    for(int i=0; i<n-1; i++){
        if(a[i]-a[i+1] == 1 || a[i]-a[i+1] == -1 || a[i]==a[i+1]){
            int s=i;
            int lg=a[i];
            int lk=a[i];
            while(s<n){
                if(lg<a[s]) lg=a[s];
                if(lk>a[s]) lk=a[s];
                if(lg-lk>1) break;
                s++;
            }
            int p=s-i+1;
            if(o.h<p){
                o.k=i;
                o.v=s-1;
                o.h=p;
            }
        }
    }
    cout<<o.h<<" "<<o.k+1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/55
1Wrong answer0/01ms316 KiB
2Wrong answer0/013ms500 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms500 KiB
6Wrong answer0/21ms508 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/31ms560 KiB
10Wrong answer0/312ms444 KiB
11Wrong answer0/33ms316 KiB
12Wrong answer0/382ms440 KiB
13Wrong answer0/334ms780 KiB
14Time limit exceeded0/3300ms736 KiB
15Time limit exceeded0/3300ms672 KiB
16Time limit exceeded0/3282ms564 KiB
17Time limit exceeded0/3286ms564 KiB
18Time limit exceeded0/3284ms564 KiB
19Time limit exceeded0/3300ms564 KiB
20Time limit exceeded0/3298ms776 KiB
21Wrong answer0/3127ms564 KiB
22Time limit exceeded0/3284ms564 KiB