215292026-01-13 11:48:58gkataMekk Mester munkái (50 pont)cpp17Wrong answer 7/5090ms2224 KiB
// mekk.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <queue>
#include <algorithm>
#define ll long long;

using namespace std;

struct adat
{
    int pos, kezd, veg;
};

bool comp(adat a, adat b)
{
    if (a.veg == b.veg) return a.kezd < b.kezd;
    return a.veg < b.veg;
}

vector<adat>x;
vector<int>mekk, fiu;

int n, m, i;
int main()
{
    cin >> n >> m;
    x.resize(n + 1);

    for (i = 1; i <= n; ++i)
    {
        cin >> x[i].kezd >> x[i].veg;
        x[i].pos = i;
    }

    sort(x.begin() + 1, x.end(), comp);
    //for (i = 1; i <= n; ++i) cout << x[i].pos << " ";

    for (i = 1; i <= n; ++i)
    {
        if ((fiu.empty() || x[fiu.back()].veg < x[i].kezd) && (mekk.empty() || x[mekk.back()].veg < x[i].kezd))
        {
            if (fiu.empty() || mekk.empty() || x[mekk.back()].veg < x[i].kezd) mekk.push_back(i);
            else fiu.push_back(i);
        }

        else if (fiu.empty() || x[fiu.back()].veg < x[i].kezd) fiu.push_back(i);
        else if (mekk.empty() || x[mekk.back()].veg < x[i].kezd) mekk.push_back(i);
    }

    cout << mekk.size() << " " << fiu.size() << endl;
    for (auto& e : mekk) cout << x[e].pos << " ";
    cout << endl;
    for (auto& e : fiu) cout << x[e].pos << " ";
}

// 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
base7/50
1Accepted0/01ms508 KiB
2Wrong answer0/08ms492 KiB
3Accepted1/11ms500 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Accepted2/21ms316 KiB
8Wrong answer0/21ms500 KiB
9Accepted3/31ms316 KiB
10Wrong answer0/12ms564 KiB
11Wrong answer0/12ms316 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/22ms500 KiB
14Wrong answer0/22ms500 KiB
15Wrong answer0/22ms416 KiB
16Wrong answer0/32ms352 KiB
17Wrong answer0/279ms1580 KiB
18Wrong answer0/281ms1584 KiB
19Wrong answer0/481ms1588 KiB
20Wrong answer0/481ms1584 KiB
21Wrong answer0/482ms1588 KiB
22Wrong answer0/482ms1588 KiB
23Wrong answer0/490ms2224 KiB