Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <clocale>
- #include <bits/stdc++.h>
- #pragma GCC optimize("Ofast")
- #pragma GCC optimize("O3")
- using namespace std;
- #define ll long long
- const int inf = (int)2e9;
- const int mod = (int)1e9 + 7;
- const double error = 1e-5;
- struct point {
- int x, y;
- point() {
- x = inf;
- y = inf;
- }
- point(int _x, int _y) {
- x = _x;
- y = _y;
- }
- bool operator < (point &other) const {
- if(x != other.x) {
- return x < other.x;
- }
- return y < other.y;
- }
- };
- int sqr(int a) {
- return a * a;
- }
- int dist(point a, point b) {
- return sqr(a.x - b.x) + sqr(a.y - b.y);
- }
- int main() {
- freopen("quadr.in", "r", stdin);
- freopen("quadr.out", "w", stdout);
- vector <point> p(4);
- for(point &cur: p) {
- scanf("%d%d", &cur.x, &cur.y);
- }
- do {
- int d0 = dist(p[0], p[1]);
- int d1 = dist(p[1], p[2]);
- int d2 = dist(p[2], p[3]);
- int d3 = dist(p[3], p[0]);
- int diag0 = dist(p[0], p[2]);
- int diag1 = dist(p[1], p[3]);
- if(d0 == d1 && d1 == d2 && d2 == d3 && d3 == d0 && diag0 == diag1 && d0 != 0) {
- return printf("YES"), 0;
- }
- }while(next_permutation(p.begin(), p.end()));
- printf("NO");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement