78462024-01-11 13:09:02szabelrSíkság (55)cpp17Wrong answer 0/55254ms14192 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) {
            multiset.insert(x);
            cout << "fel" << " " << x << endl;
        }

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

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base0/55
1Wrong answer0/03ms1816 KiB
2Wrong answer0/026ms2192 KiB
3Wrong answer0/23ms2216 KiB
4Wrong answer0/23ms2460 KiB
5Wrong answer0/23ms2812 KiB
6Wrong answer0/23ms2996 KiB
7Wrong answer0/33ms3112 KiB
8Wrong answer0/24ms3488 KiB
9Wrong answer0/34ms3560 KiB
10Wrong answer0/326ms3880 KiB
11Wrong answer0/318ms4460 KiB
12Wrong answer0/317ms4868 KiB
13Wrong answer0/3181ms14192 KiB
14Time limit exceeded0/3254ms5204 KiB
15Wrong answer0/3175ms12168 KiB
16Wrong answer0/3193ms9012 KiB
17Wrong answer0/3190ms9728 KiB
18Time limit exceeded0/3230ms13152 KiB
19Time limit exceeded0/3203ms11248 KiB
20Time limit exceeded0/3228ms13500 KiB
21Wrong answer0/3134ms8236 KiB
22Wrong answer0/3141ms10920 KiB