136312025-01-08 11:42:38AblablablaMekk Mester munkái (50 pont)cpp17Wrong answer 7/50104ms2224 KiB
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;

vector<pii> alap;

struct comp{
    bool operator()(int a, int b){
        if(alap[a].second == alap[b].second){
            return alap[a].first > alap[b].first;
        }
        return alap[a].second < alap[b].second;
    }
};

struct comp2{
    bool operator()(pii a, pii b){
        if(a.second == b.second){
            return a.first > b.first;
        }
        return a.second < b.second;
    }
};

int main(){
    int n, h;
    cin >> n >> h;

    alap.assign(n, {0, 0});
    vector<int> ind(n);
    iota(ind.begin(), ind.end(), 0);

    for(auto &x : alap){
        cin >> x.first >> x.second;
    }

    sort(ind.begin(), ind.end(), comp());
    sort(alap.begin(), alap.end(), comp2());

    vector<int> apa, fia;
    for(int i = 0; i < n; i++){
        if(apa.empty() || alap[apa.back()].second < alap[i].first){
            apa.push_back(i);
        } else if(fia.empty() || alap[fia.back()].second < alap[i].first){
            fia.push_back(i);
        }
    }

    cout << apa.size() << " " << fia.size() << "\n";
    for(int x : apa){
        cout << ind[x] + 1 << " ";
    }
    cout << "\n";
    for(int x : fia){
        cout << ind[x] + 1 << " ";
    }
    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/01ms316 KiB
2Wrong answer0/08ms316 KiB
3Accepted1/11ms500 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Accepted2/21ms508 KiB
8Wrong answer0/21ms392 KiB
9Accepted3/31ms316 KiB
10Wrong answer0/12ms316 KiB
11Wrong answer0/12ms532 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/22ms316 KiB
14Wrong answer0/22ms316 KiB
15Wrong answer0/22ms316 KiB
16Wrong answer0/32ms500 KiB
17Wrong answer0/297ms1584 KiB
18Wrong answer0/297ms1584 KiB
19Wrong answer0/497ms1588 KiB
20Wrong answer0/497ms1584 KiB
21Wrong answer0/497ms1588 KiB
22Wrong answer0/4101ms1588 KiB
23Wrong answer0/4104ms2224 KiB