-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathavoidingtheabyss.cpp
67 lines (53 loc) · 1.64 KB
/
avoidingtheabyss.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
67
// g++ -o main .cpp && ./main
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <map>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
int main() {
long max_x = pow(10, 9);
long max_y = pow(10, 9);
long min_x = -max_x;
long min_y = -max_y;
int xs, ys, xp, yp, xt, yt;
cin >> xs >> ys;
cin >> xp >> yp;
cin >> xt >> yt;
int diffxs = xs - xp;
int diffys = ys - yp;
int diffxt = xp - xt;
int diffyt = yp - yt;
int cnt = 0;
pair<int, int> t_path[10];
int cnt_t = 0;
pair<int, int> general_path[10];
xs = diffxs <= 0 ? min_x : max_x;
general_path[cnt++] = make_pair(xs, ys);
ys = diffys <= 0 ? min_y : max_y;
general_path[cnt++] = make_pair(xs, ys);
xt = diffxt <= 0 ? min_x : max_x;
t_path[cnt_t++] = make_pair(xt, yt);
yt = diffyt <= 0 ? min_y : max_y;
t_path[cnt_t++] = make_pair(xt, yt);
ys = yt;
general_path[cnt++] = make_pair(xs, ys);
xs = xt;
general_path[cnt++] = make_pair(xs, ys);
for (int i = 1; i >= 0; i--) {
general_path[cnt++] = make_pair(t_path[i].first, t_path[i].second);
}
cout << cnt << endl;
for (int i = 0; i < 6; i++) {
cout << general_path[i].first << " " << general_path[i].second << endl;
}
return 0;
}