228162026-01-15 19:45:49FintaTihamerSíkság (55)cpp17Wrong answer 6/55289ms784 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;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base6/55
1Accepted0/01ms316 KiB
2Wrong answer0/06ms440 KiB
3Wrong answer0/21ms500 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/31ms508 KiB
8Wrong answer0/22ms316 KiB
9Wrong answer0/31ms532 KiB
10Wrong answer0/36ms436 KiB
11Wrong answer0/33ms424 KiB
12Wrong answer0/346ms432 KiB
13Accepted3/330ms760 KiB
14Wrong answer0/317ms556 KiB
15Time limit exceeded0/3275ms744 KiB
16Wrong answer0/343ms588 KiB
17Wrong answer0/385ms784 KiB
18Wrong answer0/332ms616 KiB
19Time limit exceeded0/3289ms740 KiB
20Time limit exceeded0/3231ms696 KiB
21Accepted3/361ms592 KiB
22Wrong answer0/3101ms564 KiB