78612024-01-11 13:52:43szabelrSíkság (55)cpp17Wrong answer 0/55275ms11620 KiB
// Síkság.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <set>
using namespace std;
int tomb[100001];
int main()
{
    int n,x,most,max=0,z,kez=1,veg=1,kezmax,kezveg;
    cin >> n;
    cin >> x;
    multiset<int> multiset;
    multiset.insert(x);
    tomb[1] = x;
    for (int i = 2; i <= n; i++)
    {
        cin >> x;
        tomb[i] = x;
        if ((x - *multiset.begin() == 0 or x - *multiset.begin() == 1 or x - *multiset.begin() == -1) and (*multiset.rbegin() - x != 2 and *multiset.rbegin() - x != -2) ) {
            multiset.insert(x);
            cout << "fel" << " " << x << endl;
        }

        else
        {
            cout << "ennyi" ;
            cout << i << " ";
            most = multiset.size();
            cout << "most" << most << endl;
            if (most > max) {
                max = most;
                kez= i-(multiset.size());
                veg = i;
                max = most;
            }                
            z = *multiset.begin();
            multiset.erase(tomb[i- multiset.size()]);
            multiset.insert(x);
            cout << i - (multiset.size()-2) << endl;
        }
    }
    cout << max<<" ";
    cout << kez<< " ";
}

SubtaskSumTestVerdictTimeMemory
base0/55
1Wrong answer0/03ms1816 KiB
2Wrong answer0/023ms2240 KiB
3Wrong answer0/23ms2360 KiB
4Wrong answer0/23ms2540 KiB
5Wrong answer0/23ms2832 KiB
6Wrong answer0/23ms2752 KiB
7Wrong answer0/33ms2824 KiB
8Wrong answer0/24ms3112 KiB
9Wrong answer0/34ms3188 KiB
10Wrong answer0/318ms3492 KiB
11Wrong answer0/326ms4140 KiB
12Wrong answer0/317ms4280 KiB
13Time limit exceeded0/3275ms7268 KiB
14Wrong answer0/3178ms7392 KiB
15Time limit exceeded0/3238ms11620 KiB
16Time limit exceeded0/3250ms4780 KiB
17Time limit exceeded0/3222ms9128 KiB
18Time limit exceeded0/3246ms6456 KiB
19Time limit exceeded0/3225ms6008 KiB
20Time limit exceeded0/3257ms7104 KiB
21Wrong answer0/3130ms7548 KiB
22Time limit exceeded0/3201ms10324 KiB