224942026-01-15 09:48:46KSziliMekk Mester munkái (50 pont)cpp17Wrong answer 0/5092ms2352 KiB
#include <iostream>
#include <algorithm>

using namespace std;
struct munkak
{
    int sorszam, kezdes, vege;
};
munkak a[100000];

bool hasonlit(munkak a, munkak b)
{
    return a.vege<b.vege;
}

int main()
{
    int n, m, k=0, x=0;
    cin>>m;
    cin>>n;
    int b[100000];
    int c[100000];
    int d[100000];
    int e[100000];
    for(int i=0; i<m; i++)
    {
        cin>>a[i].kezdes;
        cin>>a[i].vege;
        a[i].sorszam=i+1;
    }
    sort(a, a+m, hasonlit);
    b[0]=a[0].sorszam;
    c[0]=a[0].vege;
    k++;
    d[-1]=0;
    for(int i=1; i<m; i++)
    {
        if(a[i].kezdes>c[k-1] && a[i].vege<=n)
        {
            b[k]=a[i].sorszam;
            c[k]=a[i].vege;
            k++;
        }
        else if(a[i].kezdes>d[x-1] && a[i].vege<=n)
        {
            e[x]=a[i].sorszam;
            d[x]=a[i].vege;
            x++;
        }
    }
    cout<<k<<" "<<x<<endl;
    sort(b, b+k);
    for(int i=0; i<k; i++)
    {
        cout<<b[i]<<" ";
    }
    cout<<endl;
    sort(e, e+x);
    for(int i=0; i<x; i++)
    {
        cout<<e[i]<<" ";
    }





/*10 14
2 4
1 7
7 12
10 12
3 9
4 5
6 6
8 10
10 13
3 7
*/





    return 0;
}

SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/08ms316 KiB
3Wrong answer0/11ms316 KiB
4Wrong answer0/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms508 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/12ms508 KiB
11Wrong answer0/12ms316 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/22ms316 KiB
14Wrong answer0/22ms408 KiB
15Wrong answer0/22ms316 KiB
16Wrong answer0/32ms508 KiB
17Wrong answer0/278ms1584 KiB
18Wrong answer0/278ms1400 KiB
19Wrong answer0/478ms1536 KiB
20Wrong answer0/479ms1520 KiB
21Wrong answer0/478ms1616 KiB
22Wrong answer0/479ms1700 KiB
23Wrong answer0/492ms2352 KiB