198642025-12-27 14:09:29szabelrMekk Mester munkái (50 pont)cpp17Wrong answer 7/50112ms6452 KiB
// Mekk Mester munkái.cpp : Tis file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main()
{
    int n, h,x,y;
    cin >> n >> h;
    vector<vector<int>> munkak(n);
    vector<int> res1;
    vector<int> res2;
    for (int i = 0; i < n; i++)
    {
        cin >> x>>y;
        munkak[i].push_back(x);
        munkak[i].push_back(y);
        munkak[i].push_back(i + 1);
    }
    sort(munkak.begin(), munkak.end(), [](const auto& a, const auto& b)
        {
            return a[1] < b[1];
        });
    int db1 = 1, db2 = 0;
    int end1 = munkak[0][1];
    res1.push_back(munkak[0][2]);
    int end2 = -1;
    for (int i = 1; i < n; i++)
    {
        if (munkak[i][0] <= end1)
        {
            if (munkak[i][0] > end2 or end2 == -1)
            {
                db2++;
                end2 = munkak[i][1];
                res2.push_back(munkak[i][2]);
            }
        }
        else
        {
            db1++;
            end1 = munkak[i][1];
            res1.push_back(munkak[i][2]);
        }
    }
    cout << db1 << " " << db2 << endl;
    for (auto x : res1) {
        cout << x << " ";
    }
    cout << endl;
    for (auto x : res2) {
        cout << x << " ";
    }
}

// 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/01ms316 KiB
2Wrong answer0/09ms820 KiB
3Accepted1/11ms512 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Accepted2/21ms396 KiB
8Wrong answer0/21ms500 KiB
9Accepted3/31ms316 KiB
10Wrong answer0/12ms316 KiB
11Wrong answer0/12ms440 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/22ms316 KiB
14Wrong answer0/22ms316 KiB
15Wrong answer0/22ms316 KiB
16Wrong answer0/32ms544 KiB
17Wrong answer0/2101ms5764 KiB
18Wrong answer0/2100ms5696 KiB
19Wrong answer0/4101ms5904 KiB
20Wrong answer0/4101ms5772 KiB
21Wrong answer0/4101ms5940 KiB
22Wrong answer0/4103ms5940 KiB
23Wrong answer0/4112ms6452 KiB