82552024-01-13 20:40:30szilMekk Mester munkái (50 pont)cpp17Accepted 50/5043ms7884 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, m; cin >> n >> m;
    vector<tuple<int, int, int>> v;
    for (int i = 1; i <= n; i++) {
        int a, b; cin >> a >> b;
        v.emplace_back(b, a, i);
    }
    sort(v.begin(), v.end());
    int end1 = 0, end2 = 0;
    vector<int> m1, m2;
    for (auto [r, l, idx] : v) {
        if (end1 > end2) {
            if (l > end1) {
                m1.emplace_back(idx);
                end1 = r;
            } else if (l > end2) {
                m2.emplace_back(idx);
                end2 = r;
            }
        } else {
            if (l > end2) {
                m2.emplace_back(idx);
                end2 = r;
            } else if (l > end1) {
                m1.emplace_back(idx);
                end1 = r;
            }
        }
    }
    cout << m1.size() << " " << m2.size() << "\n";
    for (int i : m1) cout << i << " ";
    cout << "\n";
    for (int i : m2) cout << i << " ";
    cout << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/06ms2644 KiB
3Accepted1/13ms2232 KiB
4Accepted1/13ms2460 KiB
5Accepted2/23ms2680 KiB
6Accepted2/23ms2752 KiB
7Accepted2/23ms2972 KiB
8Accepted2/23ms3088 KiB
9Accepted3/33ms3308 KiB
10Accepted1/13ms3560 KiB
11Accepted1/13ms3660 KiB
12Accepted2/23ms3612 KiB
13Accepted2/23ms3868 KiB
14Accepted2/23ms4088 KiB
15Accepted2/23ms4292 KiB
16Accepted3/33ms4256 KiB
17Accepted2/237ms7424 KiB
18Accepted2/237ms7724 KiB
19Accepted4/437ms7636 KiB
20Accepted4/437ms7628 KiB
21Accepted4/437ms7764 KiB
22Accepted4/439ms7736 KiB
23Accepted4/443ms7884 KiB