198812025-12-28 14:42:01madvirMekk Mester munkái (50 pont)cpp17Runtime error 0/501ms564 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct munka {
    int ind,k,v, done=0;
};

bool rule(munka x, munka y) {
    return x.k<y.k;
}

int main() {
    int n, h;
    cin >> n >> h;
    vector<munka> m;
    vector<munka> g1, g2;
    for(int i=1; i<=n; i++) {
        cin >> m[i].k >> m[i].v;
        m[i].ind=i;
    }
    sort(m.begin()+1,m.end(),rule);
    
    int nc=1, q=1;
    //eloszor az apa
    while(nc<=h) {
        while(m[q].k<nc && q<=n) q++;
        if(q<=n) {
            m[q].done=1;
            nc=m[q].v+1;
            g1.push_back(m[q]);
        }
        else nc=h+1;
    }
    
    //then the son
    nc=1; q=1;
    while(nc<=h) {
        while(m[q].k<nc && q<=n) q++;
        if(q<=n) {
            if(m[q].done==0) {
                nc=m[q].v+1;
                g2.push_back(m[q]);
            }
            else q++;
        }
        else nc=h+1;
    }
    
    cout << g1.size() << " " << g2.size() << endl;
    for(int i=1; i<=g1.size(); i++) {
        cout << g1[i].ind << " ";
    }
    cout << endl;
    for(int i=1; i<=g2.size(); i++) {
    }
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/01ms316 KiB
2Runtime error0/01ms508 KiB
3Runtime error0/11ms564 KiB
4Runtime error0/11ms316 KiB
5Runtime error0/21ms508 KiB
6Runtime error0/21ms336 KiB
7Runtime error0/21ms316 KiB
8Runtime error0/21ms508 KiB
9Runtime error0/31ms316 KiB
10Runtime error0/11ms316 KiB
11Runtime error0/11ms316 KiB
12Runtime error0/21ms316 KiB
13Runtime error0/21ms316 KiB
14Runtime error0/21ms508 KiB
15Runtime error0/21ms316 KiB
16Runtime error0/31ms500 KiB
17Runtime error0/21ms316 KiB
18Runtime error0/21ms316 KiB
19Runtime error0/41ms316 KiB
20Runtime error0/41ms316 KiB
21Runtime error0/41ms316 KiB
22Runtime error0/41ms316 KiB
23Runtime error0/41ms316 KiB