-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpermutation.cpp
63 lines (50 loc) · 1.09 KB
/
permutation.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
#include <bits/stdc++.h>
#define _DEBUG
#define ll long long
#define pb push_back
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define q(tag, i) cout << endl \
<< tag << "...." << i << "...." << endl;
using namespace std;
vector<pair<int, int>> li(3);
void heapPermutation(vector<pair<int, int>> a, int size) {
if (size == 1) {
for (pair<int, int> x : li)
cout << x.first << " " << x.second << endl;
cout << endl<< "ds "<< "...." << 34 << "...." << endl;
return;
}
for (int i = 0; i < size; i++) {
heapPermutation(a, size - 1);
if (size % 2 == 1)
swap(a[0], a[size - 1]);
else
swap(a[i], a[size - 1]);
}
}
void solve() {
ll n;
cin >> n;
REP(i, n)
cin >> li[i].first >> li[i].second;
heapPermutation(li,li.size());
}
int main() {
#ifdef _DEBUG
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int tt = clock();
#endif
int no_of_test_cases;
// cin >> no_of_test_cases;
no_of_test_cases = 1;
while (no_of_test_cases--)
{
solve();
}
#ifdef _DEBUG
cerr << "TIME = " << clock() - tt << endl;
tt = clock();
#endif
return 0;
}