| 14284 | 2025-01-10 11:39:09 | KissCsongor777 | Mekk Mester munkái (50 pont) | cpp17 | Compilation error |
#include <iostream>
#include <algorithm>
#include <set>
#include <bits/stdc++.h>
using namespace std;
struct megrendeles
{
int k,v,s,l;
};
f(megrendeles x, megrendeles y)
{
if(x.l<y.l)return 1;
else if(x.l==y.l){if(x.k<y.k)return 1; else return 0;}
else return 0;
}
megrendeles m[100001];
int main()
{
int n,h,m1,m2;
bool t;
cin>>n>>h;
int a[h+1]={0}, b[h+1]={0};
set<int> mes1,mes2;
for(int i=1; i<=n; i++)
{
cin>>m[i].k>>m[i].v;
m[i].s=i;
m[i].l=m[i].v-m[i].k;
}
sort(m+1,m+n+1,f);
for(int i=1; i<=n; i++)
{
t=true;
for(int j=m[i].k; j<=m[i].v && t; j++)if(a[j]==1)t=false;
if(t){mes1.insert(m[i].s); fill(a+m[i].k, a+m[i].v+1, 1); }
else {t=true;for(int j=m[i].k; j<=m[i].v && t; j++)if(b[j]==1)t=false;
if(t){mes2.insert(m[i].s); fill(b+m[i].k, b+m[i].v+1, 1);}}
}
cout<<mes1.size()<<" "<<mes2.size()<<endl;
set<int>::iterator it;
for(it=mes1.begin(); it!=mes1.end(); it++)cout<<*it<<" ";
cout<<endl;
for(it=mes2.begin(); it!=mes2.end(); it++)cout<<*it<<" ";
return 0;
}
open /var/local/lib/isolate/430/box/a.out: no such file or directory
main.cpp:12:1: error: ISO C++ forbids declaration of 'f' with no type [-fpermissive]
12 | f(megrendeles x, megrendeles y)
| ^