83472024-01-14 21:24:47zoliMekk Mester munkái (50 pont)cpp17Wrong answer 0/5079ms6300 KiB
#include <iostream>
#include <algorithm>
using namespace std;
struct munka
{
    int sorsz,k,v;
}a[100001];
int c[100001],b[100001],n,h,db1=0,db2=0;
void be()
{
    cin>>n>>h;
    for(int i=1;i<=n;i++)
    {
        a[i].sorsz=i;
        cin>>a[i].k>>a[i].v;
    }
}
bool hasonlit(munka x, munka y)
{
    return x.v<y.v;  /// esetleg egyenlo vegzodeskor nezni a kezdtete vagy sorszamot
}
void rendez()
{
    sort(a+1,a+n+1,hasonlit);
}
void kiir()
{
    for (int i=1;i<=n;i++) cout<<a[i].sorsz<<" "<<a[i].k<<"-"<<a[i].v<<endl;
}
int main()
{
    be();
    //kiir();
    rendez();
    //kiir();
    db1++;
    b[1]=a[1].sorsz;
    if(n>=2)  /// ha van két munka
    {
        db2++;
        c[1]=a[2].sorsz;
    }
    for(int i=3;i<=n;i++)//vegig a munkakon
        if(a[i].k>min(a[b[db1]].v,a[c[db2]].v))
            if(a[b[db1]].v<a[c[db2]].v)
            {
               db1++; b[db1]=a[i].sorsz;
            }
            else
            {
                db2++; c[db2]=a[i].sorsz;
            }
    cout<<db1<<" "<<db2<<endl;
    for(int i=1;i<=db1;i++)  cout<<b[i]<<" ";
    cout<<endl;
    for(int i=1;i<=db2;i++)  cout<<c[i]<<" ";
    cout<<endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1924 KiB
2Wrong answer0/08ms2400 KiB
3Wrong answer0/13ms2296 KiB
4Wrong answer0/13ms2508 KiB
5Wrong answer0/23ms2744 KiB
6Wrong answer0/23ms2976 KiB
7Wrong answer0/23ms3016 KiB
8Wrong answer0/23ms3152 KiB
9Wrong answer0/33ms3512 KiB
10Wrong answer0/13ms3412 KiB
11Wrong answer0/13ms3424 KiB
12Wrong answer0/24ms3552 KiB
13Wrong answer0/23ms3636 KiB
14Wrong answer0/23ms3636 KiB
15Wrong answer0/23ms3780 KiB
16Wrong answer0/33ms3756 KiB
17Wrong answer0/279ms6204 KiB
18Wrong answer0/279ms6156 KiB
19Wrong answer0/479ms6156 KiB
20Wrong answer0/479ms6160 KiB
21Wrong answer0/479ms6220 KiB
22Wrong answer0/479ms6216 KiB
23Wrong answer0/479ms6300 KiB