-
Notifications
You must be signed in to change notification settings - Fork 0
/
a.cpp
66 lines (54 loc) · 1.32 KB
/
a.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <bits/stdc++.h>
using namespace std;
// clang-format off
#define f first
#define s second
#define pb push_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define db(x) cout << '>' << #x << ':' << x << endl;
#define sz(x) ((int)(x).size())
#define newl cout << "\n"
#define all(v) v.begin(), v.end()
#define ll long long int
#define ld long double
#define vll vector<long long>
#define vvll vector<vll>
#define pll pair<long long, long long>
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
// clang-format on
ll tc, n, m, k;
const ll mxN = 1e2 + 5;
const ll mxM = 1e2 + 7;
ll inf = 1e14 + 7;
ll mod = 1e9 + 7;
int main() {
fast_io();
#ifndef ONLINE_JUDGE
freopen("../input.txt", "r", stdin);
freopen("../output.txt", "w", stdout);
#endif
cin>>n;
vll x(n), y(n), z(n);
auto comp = [&](ll i, ll j) {
if(x[i] == x[j]) {
if(y[i] == y[j]) {
return z[i] < z[j];
} else {
return y[i] < y[j];
}
} else {
return x[i] < x[j];
}
};
rep(i, 0, n) {
cin>>x[i]>>y[i]>>z[i];
}
vll ind(n);
iota(all(ind), 0);
sort(all(ind), comp);
for(int i = 0; i < n; i += 2) {
cout<<ind[i]+1<<" "<<ind[i+1]+1;
newl;
}
return 0;
}