-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlightoj 1058.cpp
More file actions
58 lines (54 loc) · 1.1 KB
/
lightoj 1058.cpp
File metadata and controls
58 lines (54 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define mx 100005
#define ll long long
#define mod 1000000007
int ar[mx],br[mx];
char ch[mx];
int n,m,ii;
vector<pair<int,int>>mp;
void solve()
{
scanf("%d",&n);
mp.clear();
for(int j=0; j<n; j++)
{
int x,y;
scanf("%d%d",&x,&y);
ar[j]=x;
br[j]=y;
}
for(int i=0; i<n; i++)
{
for(int j=i+1; j<n; j++)
{
int x,y;
x=ar[i]+ar[j];
y=br[i]+br[j];
mp.push_back({x,y});
}
}
sort(mp.begin(),mp.end());
ll re=0;
int sz=mp.size();
ll cnt=1;
for(int i=1;i<sz;i++)
{
if(mp[i]==mp[i-1])cnt++;
else re+=(cnt*(cnt-1))/2,cnt=1;
}
re+=(cnt*(cnt-1))/2;
printf("Case %d: %lld\n",++ii,re);
}
int main()
{
int t=1;
scanf("%d",&t);
while(t--)solve();
return 0;
}