結果
問題 | No.2769 Number of Rhombi |
ユーザー | Nzt3 |
提出日時 | 2024-06-01 15:23:02 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 739 ms / 5,000 ms |
コード長 | 888 bytes |
コンパイル時間 | 2,386 ms |
コンパイル使用メモリ | 214,452 KB |
実行使用メモリ | 42,496 KB |
最終ジャッジ日時 | 2024-06-01 15:23:27 |
合計ジャッジ時間 | 23,814 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 359 ms
33,152 KB |
testcase_04 | AC | 318 ms
30,848 KB |
testcase_05 | AC | 305 ms
22,528 KB |
testcase_06 | AC | 454 ms
27,648 KB |
testcase_07 | AC | 551 ms
33,408 KB |
testcase_08 | AC | 605 ms
34,048 KB |
testcase_09 | AC | 579 ms
35,584 KB |
testcase_10 | AC | 660 ms
37,888 KB |
testcase_11 | AC | 651 ms
39,552 KB |
testcase_12 | AC | 707 ms
41,088 KB |
testcase_13 | AC | 656 ms
41,856 KB |
testcase_14 | AC | 706 ms
42,368 KB |
testcase_15 | AC | 711 ms
42,368 KB |
testcase_16 | AC | 671 ms
42,496 KB |
testcase_17 | AC | 697 ms
42,496 KB |
testcase_18 | AC | 676 ms
42,496 KB |
testcase_19 | AC | 709 ms
42,368 KB |
testcase_20 | AC | 682 ms
42,368 KB |
testcase_21 | AC | 697 ms
42,368 KB |
testcase_22 | AC | 656 ms
42,496 KB |
testcase_23 | AC | 680 ms
42,368 KB |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | AC | 704 ms
41,728 KB |
testcase_26 | AC | 711 ms
42,112 KB |
testcase_27 | AC | 739 ms
42,496 KB |
testcase_28 | AC | 723 ms
42,368 KB |
testcase_29 | AC | 695 ms
42,368 KB |
testcase_30 | AC | 723 ms
42,496 KB |
testcase_31 | AC | 695 ms
40,832 KB |
testcase_32 | AC | 618 ms
34,048 KB |
testcase_33 | AC | 580 ms
34,048 KB |
testcase_34 | AC | 664 ms
36,864 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; constexpr int MOD=998244353; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define replr(i,l,r) for(int i=(l);i<(int)(r);i++) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vector P(N,array<ll,2>()); for(auto &i:P)cin>>i[0]>>i[1]; map<array<ll,4>,ll>cnt; rep(i,N){ replr(j,i+1,N){ ll x=P[i][0]-P[j][0],y=P[i][1]-P[j][1],g=gcd(x,y); x/=g,y/=g; if(y<0)x*=-1,y*=-1; if(x<0)x*=-1,y*=-1; array<ll,4>a={P[i][0]+P[j][0],P[i][1]+P[j][1],x,y}; cnt[a]+=1; } } ll ans=0; for(auto i:cnt){ ll x=i.first[3],y=-i.first[2]; if(y<0)x*=-1,y*=-1; if(x<0)x*=-1,y*=-1; if(cnt.find(array<ll,4>({i.first[0],i.first[1],x,y}))!=cnt.end()){ ans+=i.second*cnt[array<ll,4>({i.first[0],i.first[1],x,y})]; } } cout<<ans/2<<'\n'; }