88142024-01-31 16:18:59KCsengeMekk Mester munkái (50 pont)cpp14Wrong answer 1/5096ms6416 KiB
#include <iostream>
#include <bits/stdc++.h>
/*
10 14
2 4
1 7
7 12
10 12
3 9
4 5
6 6
8 10
10 13
3 7
*/
using namespace std;

typedef struct
{
    int k,v,ind;
} Intervallum;

bool rendez(Intervallum i1,Intervallum i2)
{
    return i1.v<i2.v;
}

int main()
{
    int n,napok;
    cin>>n>>napok;
    vector<Intervallum> Munka(n);
    Intervallum uj;
    for(int i=0;i<n;i++)
    {
        cin>>uj.k>>uj.v;
        uj.ind=i+1;
        Munka.at(i)=uj;
    }
    /*
    for(Intervallum x: Munka)
    {
        cout<<x.k<< " "<<x.v<<" "<<x.ind<<endl;
    }
    */

    sort(Munka.begin(),Munka.end(),rendez);
    /*
    cout<< endl;
    for(Intervallum x: Munka)
    {
        cout<<x.k<< " "<<x.v<<" "<<x.ind<<endl;
    }
    */
    int mesvege=0,fiavege=0,m=0,f=0;
    vector<int> mekk;
    vector<int> fia;
    for(int i=0;i<n;i++)
    {
        if(Munka[i].k>mesvege || Munka[i].k>fiavege)
        {
            if(mesvege<=fiavege)
            {
                mesvege=Munka[i].v;
                m++;
                mekk.push_back(Munka[i].ind);
            }
            else
            {
                fiavege=Munka[i].v;
                f++;
                fia.push_back(Munka[i].ind);
            }
        }
    }
    cout<<m<<" "<<f<<endl;
    for(int x : mekk)
        cout<<x<<" ";
    cout<<endl;
    for(int x : fia)
        cout<<x<<" ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/50
1Accepted0/03ms1808 KiB
2Wrong answer0/08ms2268 KiB
3Accepted1/13ms2268 KiB
4Wrong answer0/13ms2436 KiB
5Wrong answer0/23ms2564 KiB
6Wrong answer0/23ms2528 KiB
7Wrong answer0/23ms2656 KiB
8Wrong answer0/23ms2740 KiB
9Wrong answer0/33ms2736 KiB
10Wrong answer0/13ms2776 KiB
11Wrong answer0/13ms3000 KiB
12Wrong answer0/23ms2848 KiB
13Wrong answer0/23ms2856 KiB
14Wrong answer0/23ms2860 KiB
15Wrong answer0/23ms2984 KiB
16Wrong answer0/33ms3072 KiB
17Wrong answer0/281ms5312 KiB
18Wrong answer0/282ms5568 KiB
19Wrong answer0/481ms5528 KiB
20Wrong answer0/481ms5528 KiB
21Wrong answer0/481ms5860 KiB
22Wrong answer0/482ms5852 KiB
23Wrong answer0/496ms6416 KiB