82922024-01-14 11:03:55gyjazminMekk Mester munkái (50 pont)cpp17Wrong answer 1/5092ms9128 KiB
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <numeric>
#include <algorithm>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<pair<pair<int, int>, int>> h(n);
	for (int i = 0; i < n; i++) {
		int egyik = 0, masik = 0;
		cin >> egyik >> masik;
		h[i].first.second = egyik;
		h[i].first.first = masik;
		h[i].second = i + 1;
	}
	sort(h.begin(), h.end());
	vector<pair<pair<int, int>, int>> fianak(h);
	vector<int> a;
	vector<int> f;
	int jelenlegia = 0;
	int jelenlegif = 0;
	for (int i = 0; i < n; i++) {
		if (jelenlegia <= jelenlegif) {
			if (h[i].first.second > jelenlegia) {
				jelenlegia = h[i].first.first;
				a.push_back(h[i].second);
				//fianak[i].second = 0;				
			}
		}
		else {
			if (h[i].first.second > jelenlegif) {
				jelenlegif = h[i].first.first;
				f.push_back(h[i].second);
				//fianak[i].second = 0;				
			}
		}

	}
	/*jelenlegi = 0;
	for (int i = 0; i < fianak.size(); i++) {
		if (fianak[i].first.second > jelenlegi&&fianak[i].second!=0) {
			jelenlegi = fianak[i].first.first;
			f.push_back(fianak[i].second);
			//fianak.erase(h.begin() + i);
		}
	}*/
	cout << f.size() << " " << a.size() << endl;
	for (int i = 0; i < f.size(); i++) {
		cout << f[i] << " ";
	}
	cout << endl;
	for (int i = 0; i < a.size(); i++) {
		cout << a[i] << " ";
	}
}

SubtaskSumTestVerdictTimeMemory
base1/50
1Accepted0/03ms1812 KiB
2Wrong answer0/09ms2496 KiB
3Accepted1/13ms2088 KiB
4Wrong answer0/13ms2212 KiB
5Wrong answer0/23ms2296 KiB
6Wrong answer0/23ms2428 KiB
7Wrong answer0/23ms2672 KiB
8Wrong answer0/23ms2752 KiB
9Wrong answer0/33ms2720 KiB
10Wrong answer0/13ms2880 KiB
11Wrong answer0/13ms2956 KiB
12Wrong answer0/23ms3084 KiB
13Wrong answer0/23ms3312 KiB
14Wrong answer0/23ms3404 KiB
15Wrong answer0/23ms3400 KiB
16Wrong answer0/33ms3488 KiB
17Wrong answer0/282ms7892 KiB
18Wrong answer0/282ms7812 KiB
19Wrong answer0/482ms7720 KiB
20Wrong answer0/482ms7772 KiB
21Wrong answer0/482ms7912 KiB
22Wrong answer0/483ms8204 KiB
23Wrong answer0/492ms9128 KiB