/*
Does he have IGM on CF?
-neko_nyaa
*/
#include <bits/stdc++.h>
using namespace std;
//constant
const int mod=1e9+7;
const long long mod2=998244353LL;
const long long inf=(long long)1e18;
//define
#define PB push_back
#define MP make_pair
#define pi acos(-1)
#define int long long
//typedef
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef set<int> SI;
typedef priority_queue<int> pqi;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//freopen("triangles.in", "r", stdin);
//freopen("triangles.out", "w", stdout);
int n;
cin >> n;
int x[n],y[n];
map<int,int> x1,y1;
for(int i=0;i<n;i++)
{
cin >> x[i] >> y[i];
x1[x[i]]++;
y1[y[i]]++;
}
int ans=0;
for(int i=0;i<n;i++)
{
ans+=(x1[x[i]]-1)*(y1[y[i]]-1);
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
320 KB |
Output is correct |
11 |
Correct |
1 ms |
312 KB |
Output is correct |
12 |
Correct |
8 ms |
1228 KB |
Output is correct |
13 |
Correct |
6 ms |
1240 KB |
Output is correct |
14 |
Correct |
9 ms |
1764 KB |
Output is correct |
15 |
Correct |
102 ms |
6656 KB |
Output is correct |
16 |
Correct |
111 ms |
6812 KB |
Output is correct |
17 |
Correct |
105 ms |
6664 KB |
Output is correct |
18 |
Correct |
113 ms |
6628 KB |
Output is correct |
19 |
Correct |
264 ms |
9560 KB |
Output is correct |
20 |
Correct |
238 ms |
8520 KB |
Output is correct |
21 |
Correct |
307 ms |
10120 KB |
Output is correct |
22 |
Correct |
332 ms |
10116 KB |
Output is correct |