| 21525 | 2026-01-13 11:38:22 | gkata | Mekk Mester munkái (50 pont) | cpp17 | Compilation error |
// mekk.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <queue>
#define ll long long;
using namespace std;
struct adat
{
int pos, kezd, veg;
};
int comp(adat a, adat b)
{
if (a.veg == b.veg) return a.kezd < b.kezd;
return a.veg < b.veg;
}
vector<adat>x;
vector<int>mekk, fiu;
int n, m, i;
int main()
{
cin >> n >> m;
x.resize(n + 1);
for (i = 1; i <= n; ++i)
{
cin >> x[i].kezd >> x[i].veg;
x[i].pos = i;
}
sort(x.begin(), x.end(), comp);
//for (i = 1; i <= n; ++i) cout << x[i].pos << " ";
for (i = 1; i <= n; ++i)
{
if ((fiu.empty() || fiu.back() < x[i].kezd) && (mekk.empty() || mekk.back() < x[i].kezd))
{
if (fiu.empty() || mekk.empty() || mekk.back() < x[i].kezd) mekk.push_back(i);
else fiu.push_back(i);
}
else if (fiu.empty() || fiu.back() < x[i].kezd) fiu.push_back(i);
else if (mekk.empty() || mekk.back() < x[i].kezd) mekk.push_back(i);
}
cout << mekk.size() << " " << fiu.size() << endl;
for (auto& e : mekk) cout << e << " ";
cout << endl;
for (auto& e : fiu) cout << e << " ";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
open /var/local/lib/isolate/407/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:36:5: error: 'sort' was not declared in this scope; did you mean 'short'?
36 | sort(x.begin(), x.end(), comp);
| ^~~~
| short