181122025-09-30 19:49:01algoproMekk Mester munkái (50 pont)cpp17Wrong answer 1/5090ms2272 KiB
// UUID: 387d18c1-bbc3-4c98-9c65-1dcd8ff0de40
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, h;
    cin >> n >> h;
    vector<array<int,3>> munkak (n);
    for (int i = 0; i < n; i++) {
        cin >> munkak[i][1] >> munkak[i][0];
        munkak[i][2] = i+1;
    }
    sort(munkak.begin(),munkak.end());
    int foga = -1;
    int fogf = -1;
    vector<int> apa;
    vector<int> fia;
    int mh = 0;
    for (int i = 0; i < n; i++) {
        if (mh >= h) {
            break;
        }
        if (fogf < foga) {
            //cout << "a";
            if (munkak[mh][1] > fogf) {
                fogf = munkak[mh][0];
                fia.push_back(munkak[mh][2]);
                //cout << "a";
            }
            else if (munkak[mh][1] > foga) {
                foga = munkak[mh][0];
                apa.push_back(munkak[mh][2]);
                ///cout << "b";
            }
        }
        else {
            //cout << "b";
            if (munkak[mh][1] > foga) {
                foga = munkak[mh][0];
                apa.push_back(munkak[mh][2]);
                //cout << "a";
            }
            else if (munkak[mh][1] > fogf) {
                fogf = munkak[mh][0];
                fia.push_back(munkak[mh][2]);
                //cout << "b";
            }
        }
        //cout << "    ";
        mh++;
    }
    cout << apa.size() << " " << fia.size() << endl;
    for (int i = 0; i < apa.size(); i++) {
        cout << apa[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < fia.size(); i++) {
        cout << fia[i] << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
base1/50
1Accepted0/01ms316 KiB
2Wrong answer0/08ms316 KiB
3Accepted1/11ms316 KiB
4Wrong answer0/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/12ms316 KiB
11Wrong answer0/12ms316 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/22ms316 KiB
14Wrong answer0/22ms316 KiB
15Wrong answer0/22ms316 KiB
16Wrong answer0/31ms336 KiB
17Wrong answer0/282ms1580 KiB
18Wrong answer0/282ms1580 KiB
19Wrong answer0/482ms1600 KiB
20Wrong answer0/482ms1588 KiB
21Wrong answer0/482ms1592 KiB
22Wrong answer0/483ms1780 KiB
23Wrong answer0/490ms2272 KiB