125572024-12-22 21:52:06BucsMateMekk Mester munkái (50 pont)cpp17Wrong answer 7/5090ms2224 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Munka
{
    int kezdet, veg, sorszam;
};

bool hasonlitas(Munka munka1, Munka munka2)
{
    if(munka1.veg < munka2.veg){
        return true;
    }
    else if(munka1.veg > munka2.veg){
        return false;
    }
    else{
        return munka1.kezdet < munka2.kezdet;
    }
}

int main()
{
    int N, H;
    cin >> N >> H;
    vector<Munka> megrendelesek(N);
    vector<int> mekk, fia;
    for(int i = 0; i < N; i++){
        int eleje, vege;
        cin >> eleje >> vege;
        megrendelesek[i] = {eleje, vege, i};
    }
    sort(megrendelesek.begin(), megrendelesek.end(), hasonlitas);

    int utolso_munka_mekk = -1, utolso_munka_fia = -1;
    for(int i = 0; i < N; i++){
        if(megrendelesek[i].kezdet > utolso_munka_mekk){
            utolso_munka_mekk = megrendelesek[i].veg;
            mekk.push_back(megrendelesek[i].sorszam);
        }
        else if(megrendelesek[i].kezdet > utolso_munka_fia){
            utolso_munka_fia = megrendelesek[i].veg;
            fia.push_back(megrendelesek[i].sorszam);
        }
    }

    cout << mekk.size() << " " << fia.size() << endl;
    for(int i = 0; i < mekk.size(); i++){
        cout << mekk[i]+1 << " ";
    }
    cout << endl;
    for(int i = 0; i < fia.size(); i++){
        cout << fia[i]+1 << " ";
    }
    cout << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/01ms320 KiB
2Wrong answer0/08ms320 KiB
3Accepted1/11ms320 KiB
4Accepted1/11ms320 KiB
5Wrong answer0/21ms336 KiB
6Wrong answer0/21ms320 KiB
7Accepted2/21ms320 KiB
8Wrong answer0/21ms512 KiB
9Accepted3/31ms320 KiB
10Wrong answer0/12ms320 KiB
11Wrong answer0/12ms320 KiB
12Wrong answer0/22ms320 KiB
13Wrong answer0/22ms320 KiB
14Wrong answer0/22ms320 KiB
15Wrong answer0/22ms320 KiB
16Wrong answer0/31ms320 KiB
17Wrong answer0/282ms1588 KiB
18Wrong answer0/282ms1584 KiB
19Wrong answer0/482ms1592 KiB
20Wrong answer0/482ms1588 KiB
21Wrong answer0/482ms1488 KiB
22Wrong answer0/483ms1592 KiB
23Wrong answer0/490ms2224 KiB