Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("O3")
- #pragma GCC target("tune=native")
- #pragma GCC optimize("fast-math,unroll-loops")
- #include <math.h>
- #include <algorithm>
- #include <set>
- #include <iostream>
- #include <vector>
- #include <queue>
- #include <map>
- #include <string>
- #include <time.h>
- #include <cassert>
- #include <functional>
- #include <memory.h>
- #include <stack>
- #include <bitset>
- #include <unordered_map>
- #include <unordered_set>
- #include <random>
- #include <chrono>
- #include <complex>
- #include <fstream>
- #include <climits>
- using namespace std;
- typedef unsigned long long ull;
- typedef long long ll;
- typedef unsigned u;
- typedef long double ld;
- typedef vector<vector<int>> vvi;
- typedef unsigned char uc;
- typedef unsigned short us;
- typedef complex<double> cd;
- #define INF 1000000000
- #define LLINF 1000000000000000000LL
- #define EPS 1e-9l
- #define pii pair<int, int>
- const int DEBUG = 0;
- #ifdef LOCAL
- mt19937 gen(228);
- #else
- mt19937 gen((u)chrono::high_resolution_clock::now().time_since_epoch().count());
- #endif
- #pragma comment(linker, "/STACK:76777216")
- struct pt
- {
- double x, y;
- pt()
- {
- x = y = 0;
- }
- pt(double x, double y)
- : x(x), y(y)
- {}
- };
- struct line
- {
- double a, b, c;
- line()
- {
- a = b = c = 0;
- }
- line(double a, double b, double c) : a(a), b(b), c(c) {}
- line(pt p, pt q)
- {
- a = p.y - q.y;
- b = q.x - p.x;
- c = p.x * q.y - p.y * q.x;
- double norm = sqrt(a * a + b * b);
- a /= norm;
- b /= norm;
- c /= norm;
- }
- line perp(pt p)
- {
- double a1 = -b;
- double b1 = a;
- double c1 = -a1 * p.x - b1 * p.y;
- return line(a1, b1, c1);
- }
- };
- pt intersect(line a, line b)
- {
- double x = (b.b * a.c - b.c * a.b) / (b.a * a.b - b.b * a.a);
- double y = (b.a * a.c - a.a * b.c) / (a.a * b.b - b.a * a.b);
- return pt(x, y);
- }
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.setf(cout.fixed);
- cout.precision(12);
- auto START_TIME = chrono::high_resolution_clock::now();
- pt a, b, c;
- cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
- line l1(a, b);
- l1 = l1.perp(c);
- line l2(b, c);
- l2 = l2.perp(a);
- pt d = intersect(l1, l2);
- cout << d.x << " " << d.y;
- #ifdef LOCAL
- cerr.precision(3);
- cerr << "\nWorking time: " << chrono::duration<double>(chrono::high_resolution_clock::now() - START_TIME).count() << " sec.";
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement