結果
| 問題 |
No.2769 Number of Rhombi
|
| コンテスト | |
| ユーザー |
FplusFplusF
|
| 提出日時 | 2024-05-31 22:49:24 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,293 ms / 5,000 ms |
| コード長 | 1,108 bytes |
| コンパイル時間 | 3,804 ms |
| コンパイル使用メモリ | 262,576 KB |
| 実行使用メモリ | 56,704 KB |
| 最終ジャッジ日時 | 2024-12-21 00:46:23 |
| 合計ジャッジ時間 | 25,922 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> inline bool chmin(T &a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T &a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
ll x[1000],y[1000];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
map<pll,vector<pll>> mp;
ll n;
cin >> n;
rep(i,n) cin >> x[i] >> y[i];
rep(i,n){
rep(j,i){
mp[{x[i]+x[j],y[i]+y[j]}].emplace_back(x[j]-x[i],y[j]-y[i]);
}
}
ll ans=0;
for(auto [k,v]:mp){
map<pll,ll> cnt;
for(auto p:v) cnt[p]++;
for(auto [p,c]:cnt){
for(auto [q,d]:cnt){
auto [ax,ay]=p;
auto [bx,by]=q;
if(ax*bx+ay*by==0) ans+=c*d;
}
}
}
ans/=2;
cout << ans << '\n';
}
FplusFplusF