-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathd.cc
More file actions
30 lines (27 loc) · 647 Bytes
/
d.cc
File metadata and controls
30 lines (27 loc) · 647 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// https://codeforces.com/contest/1148/problem/D
#include <bits/stdc++.h>
using namespace std;
using ii = tuple<int, int>;
using si = stack<int>;
using vii = vector<ii>;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
vii a, b;
int n, x, y;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x < y) a.push_back({y, i + 1});
else b.push_back({x, i + 1});
}
if (a.size() > b.size())
sort(a.begin(), a.end(), greater<ii>());
else {
sort(b.begin(), b.end());
swap(a, b);
}
cout << a.size() << "\n";
for (int i = 0; i < a.size(); i++)
cout << get<1>(a[i]) << " \n"[i == a.size() - 1];
}