結果

問題 No.2769 Number of Rhombi
ユーザー maeshunmaeshun
提出日時 2024-06-01 11:40:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,266 bytes
コンパイル時間 4,699 ms
コンパイル使用メモリ 279,696 KB
実行使用メモリ 140,320 KB
最終ジャッジ日時 2024-06-01 11:40:22
合計ジャッジ時間 11,256 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for(int i=0;i<(n);++i)
#define rep1(i, n) for(int i=1;i<=(n);i++)
#define ll long long
using mint = modint998244353;
using P = pair<ll,ll>;
using lb = long double;
using T = tuple<ll, ll, ll>;
#ifdef LOCAL
#  include <debug_print.hpp>
#  define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#  define dbg(...) (static_cast<void>(0))
#endif

int main()
{
    int n;
    cin >> n;
    vector<unordered_map<ll,unordered_set<int>>> r(n);
    vector<unordered_map<ll, int>> cnt(n);
    vector<ll> x(n), y(n);
    rep(i,n) {
        cin >> x[i] >> y[i];
    }
    rep(i,n)rep(j,n) {
        if(i==j) continue;
        ll dist = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]);
        r[i][dist].insert(j);
        cnt[i][dist]++;
    }
    ll ans = 0;
    rep(i,n)rep(j,n) {
        if(i==j) continue;
        for(auto p : r[i]) {
            if(cnt[i][p.first]<2) continue;
            if(cnt[j][p.first]<2) continue;
            int val = 0;
            for(int v : p.second) {
                if(r[j][p.first].count(v)) val++;
            }
            ans += val*(val-1)/2;
        }
    }
    cout << ans/4 << endl;
    return 0;
}
0