114842024-10-08 07:38:25szabelrMekk Mester munkái (50 pont)cpp14Wrong answer 7/50695ms3696 KiB
#include <iostream>
#include <algorithm>
using namespace std;
struct munka
{
    int kn,vn,sz;
};
int h(munka x,munka y)
{
    if (x.vn<y.vn) return 1;
    else return 0;
}
int main()
{
    int n,H;
    cin>>n>>H;
    int s1[H+1] {0};
    int s2[H+1]{0};
    int jok1=0,jok2=0,jokt1[n+1],jokt2[n+1],a=1,b=1;
    munka t[n+1];
    for(int i=1; i<=n; i++){
        cin>>t[i].kn>>t[i].vn;
        t[i].sz=i;
    }
    sort(t+1,t+n+1,h);
    for(int i=1; i<=n; i++){
        int lehet1=1;
        for(int j=t[i].kn; j<=t[i].vn; j++){
            if(s1[j]==1)
                lehet1=0;
        }
        if(lehet1==1){
            for(int j=t[i].kn; j<=t[i].vn; j++){
            s1[j]=1;
        }
        jok1++;
        jokt1[a]=t[i].sz;
        a++;
        }else
        {
            int lehet2=1;
        for(int j=t[i].kn; j<=t[i].vn; j++){
            if(s2[j]==1)
                lehet2=0;
        }
        if(lehet2==1){
            for(int j=t[i].kn; j<=t[i].vn; j++){
            s2[j]=1;
        }
        jok2++;
        jokt2[b]=t[i].sz;
        b++;
        }
        }
    }
    cout<<jok1<<" "<<jok2<<endl;
    for(int i=1; i<=jok1; i++){
          cout<<jokt1[i]<<" ";
        }
    cout<<endl;
    for(int i=1; i<=jok2; i++){
        cout<<jokt2[i]<<" ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms428 KiB
2Wrong answer0/064ms668 KiB
3Accepted1/18ms1224 KiB
4Accepted1/18ms1128 KiB
5Wrong answer0/28ms1128 KiB
6Wrong answer0/28ms1132 KiB
7Accepted2/27ms1128 KiB
8Wrong answer0/24ms1184 KiB
9Accepted3/33ms420 KiB
10Wrong answer0/159ms1228 KiB
11Wrong answer0/157ms1148 KiB
12Wrong answer0/254ms1232 KiB
13Wrong answer0/246ms1128 KiB
14Wrong answer0/239ms1256 KiB
15Wrong answer0/227ms1168 KiB
16Wrong answer0/33ms384 KiB
17Time limit exceeded0/2689ms3636 KiB
18Time limit exceeded0/2695ms3476 KiB
19Time limit exceeded0/4689ms3460 KiB
20Time limit exceeded0/4686ms3544 KiB
21Time limit exceeded0/4694ms3436 KiB
22Time limit exceeded0/4694ms3488 KiB
23Time limit exceeded0/4690ms3696 KiB