83502024-01-14 22:17:03zoliMekk Mester munkái (50 pont)cpp17Wrong answer 1/5094ms6840 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 || x.v==y.v&&x.k<y.k;  /// 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]=1;
    if(n>=2)  /// ha van két munka
    {
        db2++;
        c[1]=2;
    }
    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]=i;
            }
            else
            {
                db2++; c[db2]=i;
            }
    cout<<db1<<" "<<db2<<endl;
    for(int i=1;i<=db1;i++)  cout<<a[b[i]].sorsz<<" ";
    cout<<endl;
    for(int i=1;i<=db2;i++)  cout<<a[c[i]].sorsz<<" ";
    cout<<endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/50
1Accepted0/03ms1892 KiB
2Wrong answer0/09ms2328 KiB
3Accepted1/13ms2320 KiB
4Wrong answer0/13ms2640 KiB
5Wrong answer0/23ms2800 KiB
6Wrong answer0/23ms3012 KiB
7Wrong answer0/23ms3224 KiB
8Wrong answer0/23ms3316 KiB
9Wrong answer0/33ms3320 KiB
10Wrong answer0/13ms3384 KiB
11Wrong answer0/13ms3388 KiB
12Wrong answer0/24ms3516 KiB
13Wrong answer0/24ms3860 KiB
14Wrong answer0/23ms3812 KiB
15Wrong answer0/24ms3812 KiB
16Wrong answer0/33ms3808 KiB
17Wrong answer0/286ms6120 KiB
18Wrong answer0/286ms6244 KiB
19Wrong answer0/487ms6488 KiB
20Wrong answer0/486ms6456 KiB
21Wrong answer0/486ms6360 KiB
22Wrong answer0/487ms6396 KiB
23Wrong answer0/494ms6840 KiB