82492024-01-13 20:21:34sangerafMekk Mester munkái (50 pont)cpp17Accepted 50/5094ms7000 KiB
#include<bits/stdc++.h>
using namespace std;

vector<array<int, 3>> v;

int main(){
    int n, h; cin >> n >> h;
    v.resize(n);
    for(int i=0; i<n; i++){
        cin >> v[i][1] >> v[i][0];
        v[i][2] = i+1;
    }
    sort(v.begin(), v.end());
    int a=0, b=0;
    vector<int> am, bm;
    for(int i=0; i<n; i++){
        if(a>b && a < v[i][1]){
            a = v[i][0];
            am.push_back(v[i][2]);
        }else if(b < v[i][1]){
            b = v[i][0];
            bm.push_back(v[i][2]);
        }else if(a < v[i][1]){
            a = v[i][0];
            am.push_back(v[i][2]);
        }
    }
    cout << am.size() << " " << bm.size() << endl;
    for(int x : am) cout << x << " ";
    cout << endl;
    for(int x : bm) cout << x << " ";
    cout << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1816 KiB
2Accepted0/09ms2296 KiB
3Accepted1/13ms2408 KiB
4Accepted1/13ms2592 KiB
5Accepted2/23ms2712 KiB
6Accepted2/23ms2828 KiB
7Accepted2/23ms2932 KiB
8Accepted2/23ms3140 KiB
9Accepted3/33ms3356 KiB
10Accepted1/13ms3484 KiB
11Accepted1/13ms3580 KiB
12Accepted2/23ms3580 KiB
13Accepted2/23ms3540 KiB
14Accepted2/23ms3548 KiB
15Accepted2/23ms3548 KiB
16Accepted3/33ms3836 KiB
17Accepted2/286ms6068 KiB
18Accepted2/287ms6412 KiB
19Accepted4/486ms6160 KiB
20Accepted4/486ms6160 KiB
21Accepted4/487ms6240 KiB
22Accepted4/487ms6440 KiB
23Accepted4/494ms7000 KiB