127852024-12-30 16:10:11KissCsongor777Síkság (55)cpp17Wrong answer 29/5543ms3896 KiB
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,l=0,k,x;
    cin>>n;
    multiset<int>s;
    //multiset<int>::iterator itr;
    for(int i=1; i<=n; i++)
        {
            cin>>x;
            s.insert(x);
            s.erase(s.lower_bound(x+2),s.end());
            s.erase(s.begin(),s.lower_bound(x-1));
            if(s.size()>l){l=s.size();k=i-l;}
            //for(itr=s.begin();itr!=s.end();itr++)cout<<*itr<<" ";
            //cout<<endl;
        }
        cout<<l<<" "<<k+1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base29/55
1Accepted0/01ms508 KiB
2Wrong answer0/04ms572 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms324 KiB
6Wrong answer0/21ms500 KiB
7Wrong answer0/31ms508 KiB
8Accepted2/21ms320 KiB
9Wrong answer0/31ms320 KiB
10Wrong answer0/34ms556 KiB
11Wrong answer0/33ms320 KiB
12Accepted3/34ms824 KiB
13Wrong answer0/321ms320 KiB
14Wrong answer0/343ms3896 KiB
15Wrong answer0/335ms1944 KiB
16Wrong answer0/330ms768 KiB
17Accepted3/335ms1516 KiB
18Accepted3/329ms1336 KiB
19Accepted3/332ms1488 KiB
20Accepted3/329ms1180 KiB
21Accepted3/314ms824 KiB
22Accepted3/327ms1376 KiB