結果
問題 | No.2769 Number of Rhombi |
ユーザー |
![]() |
提出日時 | 2024-05-31 21:47:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,615 ms / 5,000 ms |
コード長 | 934 bytes |
コンパイル時間 | 4,008 ms |
コンパイル使用メモリ | 262,328 KB |
最終ジャッジ日時 | 2025-02-21 17:43:50 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int n; cin>>n; vector<pair<long long,long long>> a(n); rep(i,n){ cin>>a[i].first>>a[i].second; } sort(a.begin(),a.end()); map<vector<long long>,long long> mp; long long ans = 0; rep(i,n){ for(int j=i+1;j<n;j++){ long long dx = a[j].first-a[i].first; long long dy = a[j].second-a[i].second; long long cx = a[i].first + a[j].first; long long cy = a[i].second + a[j].second; long long g = gcd(abs(dx),abs(dy)); dx /= g; dy /= g; mp[{dx,dy,cx,cy}]++; swap(dx,dy); dx *= -1; if(dx<0){ dx *= -1,dy *= -1; } else if(dx==0){ dy = abs(dy); } ans += mp[{dx,dy,cx,cy}]; } } cout<<ans<<endl; return 0; }