84272024-01-16 07:06:48BenedekMartonMekk Mester munkái (50 pont)cpp17Wrong answer 7/5094ms7852 KiB
#include <iostream>
//#include <queue>
#include <algorithm>

using namespace std;

struct kv
{
    int k;
    int v;
    int ind;
};

bool f(kv a, kv b)
{
    if(a.v==b.v)
    {
        return a.k<b.k;
    }
    return a.v<b.v;
}

int main()
{
    int n, h;
    cin >> n >> h;
    kv mun[n];
    for(int i=0; i<n; i++)
    {
        cin >> mun[i].k >> mun[i].v;
        mun[i].ind=i+1;
    }
    //queue<int> q1, q2;
    sort(mun, mun+n, f);
    int uccso1=0, uccso2=0, sz1=0, sz2=0, muel[n];
    for(int i=0; i<n; i++)
    {
        if(uccso1<mun[i].k)
        {
            muel[i]=1;
            uccso1=mun[i].v;
            sz1++;
        }
        else if(uccso2<mun[i].k)
        {
            muel[i]=2;
            uccso2=mun[i].v;
            sz2++;
        }
        else
        {
            muel[i]=0;
        }
    }
    cout << sz1 << " " << sz2 << endl;
    for(int i=0; i<n; i++)
    {
        if(muel[i]==1)
        {
            cout << mun[i].ind << " ";
        }
    }
    cout << endl;
    for(int i=0; i<n; i++)
    {
        if(muel[i]==2)
        {
            cout << mun[i].ind << " ";
        }
    }
    cout << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms1872 KiB
2Wrong answer0/09ms2352 KiB
3Accepted1/13ms2292 KiB
4Accepted1/13ms2520 KiB
5Wrong answer0/23ms2612 KiB
6Wrong answer0/23ms2856 KiB
7Accepted2/23ms3140 KiB
8Wrong answer0/23ms3104 KiB
9Accepted3/33ms3116 KiB
10Wrong answer0/13ms3372 KiB
11Wrong answer0/13ms3536 KiB
12Wrong answer0/23ms3612 KiB
13Wrong answer0/24ms3744 KiB
14Wrong answer0/23ms3952 KiB
15Wrong answer0/24ms4164 KiB
16Wrong answer0/33ms4272 KiB
17Wrong answer0/283ms7736 KiB
18Wrong answer0/282ms7628 KiB
19Wrong answer0/483ms7716 KiB
20Wrong answer0/483ms7712 KiB
21Wrong answer0/485ms7620 KiB
22Wrong answer0/486ms7848 KiB
23Wrong answer0/494ms7852 KiB