215262026-01-13 11:39:13gkataMekk Mester munkái (50 pont)cpp17Hibás válasz 0/5090ms2232 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;
};

int 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(), x.end(), comp);
    //for (i = 1; i <= n; ++i) cout << x[i].pos << " ";

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

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

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

// 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base0/50
1Hibás válasz0/02ms316 KiB
2Hibás válasz0/08ms388 KiB
3Hibás válasz0/12ms316 KiB
4Hibás válasz0/12ms316 KiB
5Hibás válasz0/21ms316 KiB
6Hibás válasz0/22ms316 KiB
7Hibás válasz0/21ms540 KiB
8Hibás válasz0/21ms316 KiB
9Hibás válasz0/31ms316 KiB
10Hibás válasz0/12ms340 KiB
11Hibás válasz0/12ms316 KiB
12Hibás válasz0/22ms416 KiB
13Hibás válasz0/22ms316 KiB
14Hibás válasz0/22ms412 KiB
15Hibás válasz0/22ms316 KiB
16Hibás válasz0/32ms412 KiB
17Hibás válasz0/286ms1960 KiB
18Hibás válasz0/286ms1964 KiB
19Hibás válasz0/489ms1964 KiB
20Hibás válasz0/486ms1964 KiB
21Hibás válasz0/486ms1984 KiB
22Hibás válasz0/486ms1968 KiB
23Hibás válasz0/490ms2232 KiB