230862026-01-16 11:47:55helloworldMekk Mester munkái (50 pont)cpp17Wrong answer 0/5072ms2804 KiB
#include <iostream>
#include <algorithm>
using namespace std;

int N,M;

int kezdo_A[100000];
int kezdo_B[100000];
int jo_A[100000];
int jo_B[100000];
int azonosito_A[100000];
int azonosito_B[100000];
int id_A[100000];
int id_B[100000];
int dbA=0, dbB=0;

int main()
{

    cin>>N>>M;

    for(int i=1; i<=M; i++){
        kezdo_A[i]=0;
        kezdo_B[i]=0;
        jo_A[i]=0;
        jo_B[i]=0;
        id_A[i]=0;
        id_B[i]=0;
    }
    int a,b;

    for(int i=1; i<=N; i++){
        cin>>a>>b;
        if(kezdo_A[a]==0 && kezdo_A[b]==0){
            int db=0;
            for(int j=a; j<=b; j++){
                if(kezdo_A[j]==0)db++;
                else break;
            }
            if(b-a+1==db){
                //cout<<"A: "<<a<<"--"<<b<<"   ";
                jo_A[a]=b;
                id_A[a]=i;
                dbA++;

                for(int j=a; j<=b; j++){
                    kezdo_A[j]=1;

                }
            }
        }
        else{
            if( kezdo_B[a]==0 && kezdo_B[b]==0){
                int db=0;
                for(int j=a; j<=b; j++){
                    if(kezdo_B[j]==0)db++;
                    else break;
                }
                if(b-a+1==db){
                    //cout<<"B: "<<a<<"--"<<b<<"   ";
                    jo_B[a]=b;
                    id_B[a]=i;
                    dbB++;
                    for(int j=a; j<=b; j++){
                    kezdo_B[j]=1;
                }
                }
            }
        }
    }
    /*cout<<"\n";


    for(int i=1; i<=M; i++){
        cout<<kezdo_A[i]<<" ";
    }
    cout<<"\n";

    for(int i=1; i<=M; i++){
        cout<<kezdo_B[i]<<" ";
    }
    cout<<"\n";


    for(int i=1; i<=M; i++){
        if(jo_A[i]!=0)cout<<i<<"--"<<jo_A[i]<<" ";
    }
    cout<<"\n";

    for(int i=1; i<=M; i++){
        if(jo_B[i]!=0)cout<<i<<"--"<<jo_B[i]<<" ";
    }
    cout<<"\n";*/

    cout<<dbA<<" "<<dbB<<"\n";
    for(int i=1; i<=M; i++){
        if(jo_A[i]!=0)cout<<id_A[i]<<" ";
    }
    cout<<"\n";

    for(int i=1; i<=M; i++){
        if(jo_B[i]!=0)cout<<id_B[i]<<" ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms316 KiB
2Wrong answer0/07ms564 KiB
3Wrong answer0/14ms2612 KiB
4Wrong answer0/14ms2612 KiB
5Wrong answer0/24ms2512 KiB
6Wrong answer0/23ms2616 KiB
7Wrong answer0/23ms2612 KiB
8Wrong answer0/23ms2612 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/14ms2612 KiB
11Wrong answer0/14ms2612 KiB
12Wrong answer0/24ms2756 KiB
13Wrong answer0/24ms2760 KiB
14Wrong answer0/24ms2612 KiB
15Wrong answer0/24ms2612 KiB
16Wrong answer0/31ms316 KiB
17Wrong answer0/267ms2756 KiB
18Wrong answer0/267ms2772 KiB
19Wrong answer0/468ms2756 KiB
20Wrong answer0/468ms2752 KiB
21Wrong answer0/468ms2756 KiB
22Wrong answer0/468ms2804 KiB
23Wrong answer0/472ms2756 KiB