84122024-01-15 16:38:41MrChipserMekk Mester munkái (50 pont)cpp17Accepted 50/5094ms7460 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct munka
{
    int k;
    int v;
    int s;
};
munka m[100000];
int n,h;
bool compare(munka a, munka b)
{
    if(a.v < b.v)
        return true;
    else
        return false;
}
int main()
{
    cin >> n >> h;
    for(int i = 0; i < n; i++)
    {
        cin >> m[i].k >> m[i].v;
        m[i].s=i+1;
    }
    sort(m, m+n, compare);
    /*for(int i = 0; i < n; i++)
    {
        cout << m[i].s << " " << m[i].k << " " << m[i].v << endl;
    }*/
    int elozo = 1;
    int mekk = 0;
    int fia = 0;
    vector<int> mekkm;
    vector<int> fiam;
    for(int i = 0; i < n; i++)
    {
        if(m[i].k>mekk && m[i].k>fia)
        {
            if(elozo==1)
            {
                mekkm.push_back(m[i].s);
                mekk=m[i].v;
            }
            else
            {
                fiam.push_back(m[i].s);
                fia=m[i].v;
            }
        }
        else if(m[i].k>mekk)
        {
            mekkm.push_back(m[i].s);
            mekk=m[i].v;
            elozo = 1;

        }
        else if(m[i].k>fia)
        {
            fiam.push_back(m[i].s);
            fia=m[i].v;
            elozo = 2;
        }
    }
    //sort(mekkm.begin(),mekkm.end());
    //sort(fiam.begin(),fiam.end());;
    cout << mekkm.size() << " " << fiam.size() << endl;
    for(int i = 0; i < mekkm.size(); i++)
        cout << mekkm[i] << " ";
    cout << endl;
    for(int i = 0; i < fiam.size(); i++)
        cout << fiam[i] << " ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1816 KiB
2Accepted0/09ms2252 KiB
3Accepted1/13ms2224 KiB
4Accepted1/13ms2300 KiB
5Accepted2/23ms2304 KiB
6Accepted2/23ms2432 KiB
7Accepted2/23ms2644 KiB
8Accepted2/23ms2860 KiB
9Accepted3/33ms2960 KiB
10Accepted1/13ms3100 KiB
11Accepted1/13ms3180 KiB
12Accepted2/24ms3308 KiB
13Accepted2/23ms3540 KiB
14Accepted2/23ms3736 KiB
15Accepted2/23ms3700 KiB
16Accepted3/33ms3968 KiB
17Accepted2/285ms6368 KiB
18Accepted2/285ms6220 KiB
19Accepted4/485ms6224 KiB
20Accepted4/485ms6236 KiB
21Accepted4/486ms6524 KiB
22Accepted4/486ms6776 KiB
23Accepted4/494ms7460 KiB