228172026-01-15 19:46:27FintaTihamerSíkság (55)cpp17Wrong answer 0/55284ms700 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[n];
    for(int i=0; i<n; i++){cin>>a[i];}
    Volgy o;
    o.k=0;
    o.v=0;
    o.h=0;
    for(int i=0; i<n; i++){
        if(a[i]-a[i+1] == 1 || a[i]-a[i+1] == -1){
            int s=i;
            int p=0;
            int lg=a[i];
            int lk=a[i];
            while(s<n && lk==lg-1 || lk==lg){
                if(lg<a[s]) lg=a[s];
                if(lk>a[s]) lk=a[s];
                //cout<<lg-lk<<" "<<a[s]<<"\n";
                s++;
                p++;
            }
            if(o.h<p){
                //cout<<1;
                o.h=p;
                o.k=i;
                o.v=s;
            }
        }
    }
    cout<<o.h<<" "<<o.k+1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/55
1Wrong answer0/01ms316 KiB
2Wrong answer0/04ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/36ms432 KiB
11Wrong answer0/33ms388 KiB
12Wrong answer0/346ms428 KiB
13Wrong answer0/330ms544 KiB
14Wrong answer0/317ms700 KiB
15Time limit exceeded0/3275ms584 KiB
16Wrong answer0/343ms580 KiB
17Wrong answer0/383ms564 KiB
18Wrong answer0/332ms564 KiB
19Time limit exceeded0/3284ms564 KiB
20Time limit exceeded0/3232ms564 KiB
21Wrong answer0/361ms564 KiB
22Wrong answer0/3101ms564 KiB