Cod sursa(job #2798854)

Utilizator VladPislaruPislaru Vlad Rares VladPislaru Data 11 noiembrie 2021 23:58:50
Problema Patrate 3 Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.96 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin ("patrate3.in");
ofstream fout  ("patrate3.out");

set <pair<double, double>> M;

int main()
{
    int n, cnt = 0;
    fin >> n;
    for (int i = 1; i <= n; i++)
    {
        double x , y;
        fin >> x >> y;
        M.insert({x, y});
    }
    for (auto i = M.begin(); i != M.end (); i++)
        for (auto j = i; j != M.end (); j++)
        {
            pair <double ,double> C, D;
            C = D = {0 , 0};
            C.first = i -> first + (i -> second - j -> second);
            C.second = i -> second + (i -> first - j -> first);
            D.first = j -> first + (i -> second - j -> second);
            D.second = j -> second + (i -> first - j -> first);
            if (M.find (C) != M.end () && M.find (D) != M.end ())
                cnt++;
        }
    fout << cnt / 4 << "\n";
    /**
        *    *     *


        *    *     *

    */

    return 0;
}