114852024-10-08 07:46:52szabelrMekk Mester munkái (50 pont)cpp14Wrong answer 7/50699ms3228 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]{0},jokt2[n+1]{0},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/02ms360 KiB
2Wrong answer0/052ms616 KiB
3Accepted1/18ms1300 KiB
4Accepted1/18ms1268 KiB
5Wrong answer0/28ms1128 KiB
6Wrong answer0/28ms1128 KiB
7Accepted2/27ms1272 KiB
8Wrong answer0/24ms1132 KiB
9Accepted3/33ms384 KiB
10Wrong answer0/157ms1176 KiB
11Wrong answer0/157ms1144 KiB
12Wrong answer0/254ms1128 KiB
13Wrong answer0/246ms1296 KiB
14Wrong answer0/239ms1144 KiB
15Wrong answer0/227ms1180 KiB
16Wrong answer0/33ms360 KiB
17Time limit exceeded0/2699ms2920 KiB
18Time limit exceeded0/2697ms3056 KiB
19Time limit exceeded0/4698ms3048 KiB
20Time limit exceeded0/4697ms3228 KiB
21Time limit exceeded0/4699ms3048 KiB
22Time limit exceeded0/4694ms3048 KiB
23Time limit exceeded0/4694ms3048 KiB