231022026-01-16 12:09:18MrkzMekk Mester munkái (50 pont)cpp17Wrong answer 0/5039ms3536 KiB
#include <bits/stdc++.h>

using namespace std;
int H,N;
struct mekk{
    int k;
    int v;
    int hossz;
    bool fog;
};
vector<mekk> rendeles;
bool rendz(mekk a, mekk b) {
    if(a.k==b.k)
        return a.hossz<b.hossz;
    return a.k<b.k;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    istream *in;
    ifstream f("mekk.in");
    //in = &f;
    in = &cin;
    (*in)>>N>>H;
    rendeles.resize(N+1);
    for(int i=1;i<=N;i++){
        (*in)>>rendeles[i].k>>rendeles[i].v;
        rendeles[i].hossz=rendeles[i].v-rendeles[i].k;
    }
    /*for(int i=1;i<=N;i++){
        cout<<rendeles[i].k<<" "<<rendeles[i].v<<" "<<rendeles[i].hossz<<endl;
    }
    cout<<endl;*/
    sort(rendeles.begin(), rendeles.end(), rendz);
    /*for(int i=1;i<=N;i++){
        cout<<rendeles[i].k<<" "<<rendeles[i].v<<" "<<rendeles[i].hossz<<endl;
    }*/
    vector<int> apa(H+1);
    vector<int> fiu(H+1);
    int m1=0, m2=0, A=1, F=1;
    vector<int> Apa(N+1);
    vector<int> Fiu(N+1);
    for(int i=1;i<=N;i++){
        if(apa[rendeles[i].k]==0 && rendeles[i].fog==false){
            for(int j=rendeles[i].k; j<=rendeles[i].v; j++){
                apa[j]=1;
            }
            m1++;
            rendeles[i].fog=true;
            Apa[A++]=i;
        }
        if(fiu[rendeles[i].k]==0 && rendeles[i].fog==false){
            for(int j=rendeles[i].k; j<=rendeles[i].v; j++){
                fiu[j]=1;
            }
            m2++;
            rendeles[i].fog=true;
            Fiu[F++]=i;
        }
    }
    cout<<m1<<" "<<m2<<endl;
    for(int i=1; i<A; i++)
        cout<<Apa[i]<<" ";
    cout<<endl;
    for(int i=1; i<F; i++)
        cout<<Fiu[i]<<" ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/04ms580 KiB
3Wrong answer0/12ms1076 KiB
4Wrong answer0/12ms1076 KiB
5Wrong answer0/22ms1084 KiB
6Wrong answer0/22ms1216 KiB
7Wrong answer0/22ms1076 KiB
8Wrong answer0/22ms1260 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/12ms1268 KiB
11Wrong answer0/12ms1148 KiB
12Wrong answer0/22ms1076 KiB
13Wrong answer0/22ms1076 KiB
14Wrong answer0/22ms1076 KiB
15Wrong answer0/22ms1076 KiB
16Wrong answer0/31ms316 KiB
17Wrong answer0/239ms3536 KiB
18Wrong answer0/239ms3528 KiB
19Wrong answer0/439ms3532 KiB
20Wrong answer0/439ms3380 KiB
21Wrong answer0/439ms3380 KiB
22Wrong answer0/439ms3380 KiB
23Wrong answer0/439ms3536 KiB