127352024-12-29 15:52:44KissCsongor777Síkság (55)cpp17Wrong answer 0/55300ms568 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int n,l=0,k,x;
    cin>>n;
    vector<int>h;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        h.push_back(x);
        if(*max_element(h.begin(),h.end())-*min_element(h.begin(),h.end())>=2)
            while(*max_element(h.begin(),h.end())-*min_element(h.begin(),h.end())>=2)h.erase(h.begin()+1);
        if(h.size()>l)l=h.size()-1;
        k=i-l;
    }
    cout<<l<<" "<<k;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/55
1Accepted0/01ms320 KiB
2Wrong answer0/04ms320 KiB
3Wrong answer0/21ms500 KiB
4Wrong answer0/21ms320 KiB
5Wrong answer0/21ms508 KiB
6Wrong answer0/21ms320 KiB
7Wrong answer0/31ms508 KiB
8Wrong answer0/21ms500 KiB
9Wrong answer0/31ms336 KiB
10Wrong answer0/36ms320 KiB
11Wrong answer0/33ms320 KiB
12Wrong answer0/398ms440 KiB
13Wrong answer0/330ms400 KiB
14Time limit exceeded0/3300ms432 KiB
15Time limit exceeded0/3298ms456 KiB
16Wrong answer0/3193ms320 KiB
17Time limit exceeded0/3300ms568 KiB
18Wrong answer0/334ms320 KiB
19Wrong answer0/348ms320 KiB
20Wrong answer0/332ms320 KiB
21Wrong answer0/317ms508 KiB
22Wrong answer0/368ms556 KiB