95182024-02-22 13:32:061478Mekk Mester munkái (50 pont)python3Runtime error 0/5018ms13664 KiB
#include <bits/stdc++.h>  
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
ll MOD = 1e9 + 7;

bool rule(vector<int> a, vector<int> b){
	return a[1] < b[1];
}

bool rule2(vector<int> a, vector<int> b){
	return a[2] < b[2];
}
int main()
{
	//ifstream cin("in.txt");
	int n, m;
	cin >> n >> m;
	vector<vector<int>> t(n + 1, vector<int>(3));
	for(int i = 1; i <= n; i++){
		int s, e;
		cin >> s >> e;
		t[i] = {s, e, i};
	}

	
	/*for(int i = 1; i <= n; i++){
		cout << t[i][2] << " ";
	}
	cout << '\n';*/

	sort(t.begin() + 1, t.end(), rule);

	vector<vector<int>> m1, m2;
	m1.push_back(t[1]);
	if(n > 1){
		m2.push_back(t[2]);	
		for(int i = 3; i <= n; i++){
			if(t[i][0] > m1[m1.size() - 1][1] && t[i][0] > m2[m2.size() - 1][1]){
				if(m1[m1.size() - 1][1] < m2[m2.size() - 1][1]){
					m1.push_back(t[i]);
				}
				else{
					m2.push_back(t[i]);
				}
			}
			else if(t[i][0] > m1[m1.size() - 1][1]){
				m1.push_back(t[i]);
			}
			else if(t[i][0] > m2[m2.size() - 1][1]){
				m2.push_back(t[i]);
			}
		}
	}
	cout << m1.size() << " " << m2.size() << '\n';
	sort(m1.begin(), m1.end(), rule2);
	for(int i = 0; i < m1.size(); i++){
		cout << m1[i][2] << " ";
	}
	cout << '\n';
	sort(m2.begin(), m2.end(), rule2);
	for(int i = 0; i < m2.size(); i++){
		cout << m2[i][2] << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/017ms11040 KiB
2Runtime error0/017ms11436 KiB
3Runtime error0/117ms11140 KiB
4Runtime error0/117ms11636 KiB
5Runtime error0/217ms11656 KiB
6Runtime error0/217ms11752 KiB
7Runtime error0/217ms11984 KiB
8Runtime error0/217ms11692 KiB
9Runtime error0/317ms11972 KiB
10Runtime error0/117ms11804 KiB
11Runtime error0/117ms12136 KiB
12Runtime error0/217ms12228 KiB
13Runtime error0/217ms12536 KiB
14Runtime error0/217ms12656 KiB
15Runtime error0/217ms12688 KiB
16Runtime error0/317ms13028 KiB
17Runtime error0/217ms13372 KiB
18Runtime error0/217ms13016 KiB
19Runtime error0/417ms13044 KiB
20Runtime error0/417ms13272 KiB
21Runtime error0/418ms13604 KiB
22Runtime error0/417ms13664 KiB
23Runtime error0/417ms13584 KiB