83662024-01-15 00:51:26TuruTamasMekk Mester munkái (50 pont)cpp17Accepted 50/5097ms11016 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
ifstream in_file("minta/be2.txt");
#define input in_file
#define INTHENAMEOFGOD
#else
#define input cin
#define INTHENAMEOFGOD \
    ios::sync_with_stdio(0); \
    cin.tie(0); \
    cout.tie(0);
#endif
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<ll, ll> pii;
typedef array<ll, 3> all;

ll N, H, a, b;
vi mi, fi;
ll mv, fv;
vector<all> munkak;

int main()
{
    input >> N >> H;
    for (ll n = 1; n <= N; n++) {
        input >> a >> b;
        munkak.push_back({b, a, n});
    }
    sort(munkak.begin(), munkak.end());
    for (all a : munkak) {
        if (mv > fv && a[1] > mv) {
            mi.push_back(a[2]);
            mv = a[0];
        } else if (fv > mv && a[1] > fv) {
            fi.push_back(a[2]);
            fv = a[0];
        } else if (a[1] > mv) {
            mi.push_back(a[2]);
            mv = a[0];
        } else if (a[1] > fv) {
            fi.push_back(a[2]);
            fv = a[0];
        }
    }
    cout << mi.size() << " " << fi.size() << "\n";
    for (ll val : mi)
        cout << val << " ";
    cout << "\n";
    for (ll val : fi)
        cout << val << " ";
    cout << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/09ms3148 KiB
3Accepted1/13ms2376 KiB
4Accepted1/13ms2580 KiB
5Accepted2/23ms2664 KiB
6Accepted2/23ms2768 KiB
7Accepted2/23ms2928 KiB
8Accepted2/23ms3024 KiB
9Accepted3/33ms3144 KiB
10Accepted1/13ms3524 KiB
11Accepted1/13ms3480 KiB
12Accepted2/23ms3476 KiB
13Accepted2/23ms3476 KiB
14Accepted2/23ms3484 KiB
15Accepted2/23ms3732 KiB
16Accepted3/33ms3944 KiB
17Accepted2/289ms10164 KiB
18Accepted2/290ms10092 KiB
19Accepted4/489ms10092 KiB
20Accepted4/490ms10352 KiB
21Accepted4/490ms10552 KiB
22Accepted4/490ms10512 KiB
23Accepted4/497ms11016 KiB