Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- +---------------------------------------------+
- | |
- | © 17/04/2023 (18:14) MinaMagdy |
- | |
- +---------------------------------------------+
- */
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/tree_policy.hpp>
- using namespace std;
- using namespace __gnu_pbds;
- #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
- #define multi_ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
- #define endl "\n"
- #define MOD 1000000007
- #define INF 2000000000
- #define all(s) s.begin(), s.end()
- #define rall(s) s.rbegin(), s.rend()
- #define sz(x) int(x.size())
- typedef long long ll;
- typedef long double ld;
- typedef unsigned long long ull;
- // ---------------------------> GEOMETRY <---------------------------
- #define EPS 1e-9
- #define PI acos(-1)
- #define X real()
- #define Y imag()
- #define angle(a) atan2(a.Y, a.X)
- #define vec(a, b) point((b) - (a))
- #define length(a) hypot(a.Y, a.X)
- #define normalize(a) (a) / length(a)
- #define dot_prod(a, b) real(conj(a) * (b))
- #define cross_prod(a, b) imag(conj(a) * (b))
- #define lengthSqr(p) dot_prod(p, p)
- #define rotateO(p, ang) p * exp(point(0, ang))
- #define rotateA(p, about, ang) rotateO(vec((about), (p)), ang) + (about)
- #define reflicatO(v, m) conj(v / m) * m
- #define reflicatA(v, about, m) conj(vec(about, v) / vec(about, m)) * vec(about, m) + about
- typedef complex<ld> point;
- bool cin_point(point &p) {
- double x = -INF, y = -INF;
- cin >> x >> y;
- p = {x, y};
- return x != -INF or y != -INF;
- }
- void solve() {
- ld x1, y1, x2, y2, x3, y3, x4, y4;
- while (scanf("%Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != EOF) {
- vector<point> p = {{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}};
- sort(all(p), [](point a, point b) {
- if (a.X == b.X) return a.Y < b.Y;
- return a.X < b.X;
- });
- point ans;
- if (p[0] == p[1]) {
- ans = p[2] + p[3] - p[0];
- }
- else if (p[1] == p[2]) {
- ans = p[0] + p[3] - p[1];
- }
- else if (p[2] == p[3]) {
- ans = p[0] + p[1] - p[2];
- }
- cout << fixed << setprecision(3) << ans.X << " " << ans.Y << endl;
- }
- }
- int main(void)
- {
- ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
- int testcase = 1;
- // cin >> testcase;
- while (testcase--)
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement