84252024-01-16 07:02:00BenedekMartonMekk Mester munkái (50 pont)cpp17Compilation error
#include <iostream>
//#include <queue>
#include <algorithm>

using namespace std;

struct kv
{
    int k;
    int v;
    int ind;
};

f(kv a, kv b)
{
    return a.v<b.v;
}

int main()
{
    int n, h;
    cin >> n >> h;
    kv mun[n];
    for(int i=0; i<n; i++)
    {
        cin >> mun[i].k >> mun[i].v;
        mun[i].ind=i+1;
    }
    //queue<int> q1, q2;
    sort(mun, mun+n, f);
    int uccso1=0, uccso2=0, sz1=0, sz2=0, muel[n];
    for(int i=0; i<n; i++)
    {
        if(uccso1<mun[i].k)
        {
            muel[i]=1;
            uccso1=mun[i].v;
            sz1++;
        }
        else if(uccso2<mun[i].k)
        {
            muel[i]=2;
            uccso2=mun[i].v;
            sz2++;
        }
        else
        {
            muel[i]=0;
        }
    }
    cout << sz1 << " " << sz2 << endl;
    for(int i=0; i<n; i++)
    {
        if(muel[i]==1)
        {
            cout << mun[i].ind << " ";
        }
    }
    cout << endl;
    for(int i=0; i<n; i++)
    {
        if(muel[i]==2)
        {
            cout << mun[i].ind << " ";
        }
    }
    cout << endl;
    return 0;
}
Compilation error
exit status 1
main.cpp:14:1: error: ISO C++ forbids declaration of 'f' with no type [-fpermissive]
   14 | f(kv a, kv b)
      | ^
Exited with error status 1