Cod sursa(job #2519353)

Utilizator CharacterMeCharacter Me CharacterMe Data 7 ianuarie 2020 16:50:41
Problema Trapez Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1.46 kb
#include <bits/stdc++.h>
#define x first
#define y second
#define inf 1.0/0.0
std::ifstream fin("trapez.in");
std::ofstream fout("trapez.out");
typedef long long ll;
ll n, sol;
std::pair<ll, ll> list[1005];
std::unordered_map<double, std::unordered_map<double, ll> > m_l;
std::unordered_map<double, std::unordered_map<double, ll> >::iterator itm_l;
std::unordered_map<double, ll> m;
std::unordered_map<double, ll>::iterator itm;
double calc_m(std::pair<ll, ll> p1, std::pair<ll, ll> p2);
double calc_l(std::pair<ll, ll> p1, std::pair<ll, ll> p2);
int main()
{
    fin>>n;
    for(int i=1; i<=n; ++i){
        fin>>list[i].x>>list[i].y;
    }
    for(int i=1; i<n; ++i){
        for(int j=i+1; j<=n; ++j){
            /*++m[calc_m(list[i], list[j])];
            ++m_l[calc_m(list[i], list[j])][calc_l(list[i], list[j])];*/
            ll p=5;
        }
    }
    /*itm_l=m_l.begin();
    while(itm_l!=m_l.end()){
        ll sum=m[itm_l->first];
        itm=(itm_l->second).begin();
        while(itm!=(itm_l->second).end()){
            sum-=itm->second;
            sol=sol+(itm->second)*((itm->second)-1)+(itm->second)*sum;
            ++itm;
        }
        ++itm_l;
    }*/
    fout<<sol;
    return 0;
}
double calc_m(std::pair<ll, ll> p1, std::pair<ll, ll> p2){
    return 1.0*(p2.y-p1.y)/(p2.x-p1.x);
}
double calc_l(std::pair<ll, ll> p1, std::pair<ll, ll> p2){
    return 1.0*sqrt((p2.y-p1.y)*(p2.y-p1.y)+(p2.x-p1.x)*(p2.x-p1.x));
}