198932025-12-29 09:31:11PappMatyasMekk Mester munkái (50 pont)cpp17Wrong answer 7/50699ms1552 KiB
#include <iostream>
#include <vector>

using namespace std;

class int2
{
	public:
	int x;
	int y;
};

int main()
{
	vector<int2> h;
	vector<bool> used;
	int n, m;
	cin >> n >> m;
	int2 in{};
	for (int i = 0; i < n; i++)
	{
		cin >> in.x >> in.y;
		h.push_back(in);
		used.push_back(false);
	}
	int am1 = 0;
	vector<int> a1;
	bool done = false;
	int last = 0;
	while (!done)
	{
		done = true;
		int min = m + 1;
		int s = -1;
		for (int i = 0; i < n; i++)
		{
			if (!used[i])
			{
				if (h[i].x > last)
				{
					if (h[i].y < min)
					{
						min = h[i].y;
						s = i;
						done = false;
					}
				}
			}
		}
		if (!done)
		{
			used[s] = true;
			last = h[s].y;
			am1++;
			a1.push_back(s + 1);
		}
	}

	int am2 = 0;
	vector<int> a2;
	done = false;
	last = 0;
	while (!done)
	{
		done = true;
		int min = m + 1;
		int s = -1;
		for (int i = 0; i < n; i++)
		{
			if (!used[i])
			{
				if (h[i].x > last)
				{
					if (h[i].y < min)
					{
						min = h[i].y;
						s = i;
						done = false;
					}
				}
			}
		}
		if (!done)
		{
			used[s] = true;
			last = h[s].y;
			am2++;
			a2.push_back(s + 1);
		}
	}


	cout << am1 << " " << am2 << endl;
	for (int i = 0; i < am1; i++)
	{
		cout << a1[i] << " ";
	}
	cout << endl;
	for (int i = 0; i < am2; i++)
	{
		cout << a2[i] << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/01ms508 KiB
2Wrong answer0/017ms564 KiB
3Accepted1/11ms508 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms500 KiB
7Accepted2/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Accepted3/31ms316 KiB
10Wrong answer0/12ms316 KiB
11Wrong answer0/12ms316 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/23ms316 KiB
14Wrong answer0/24ms316 KiB
15Wrong answer0/26ms416 KiB
16Wrong answer0/37ms404 KiB
17Wrong answer0/2377ms1484 KiB
18Wrong answer0/2389ms1504 KiB
19Wrong answer0/4570ms1552 KiB
20Time limit exceeded0/4699ms1512 KiB
21Time limit exceeded0/4686ms1452 KiB
22Time limit exceeded0/4699ms1400 KiB
23Time limit exceeded0/4681ms1456 KiB