# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
#define pii pair<int,int>
const int N = 3e5 + 5;
const int INF = 1e9;
const ll mod = 1e9+7;
int x[N],y[N];
map<int,int>row,col;
int n;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("triangles.in","r",stdin);
//freopen("triangles.out","w",stdout);
cin>>n;
for(int i = 1;i<=n;i++){
cin>>x[i]>>y[i];
row[x[i]]++;
col[y[i]]++;
}
ll ans = 0;
for(int i = 1;i<=n;i++){
ans += (1LL * (row[x[i]]-1) * (col[y[i]]-1));
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
492 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
7 ms |
1004 KB |
Output is correct |
13 |
Correct |
7 ms |
1132 KB |
Output is correct |
14 |
Correct |
11 ms |
1388 KB |
Output is correct |
15 |
Correct |
122 ms |
6252 KB |
Output is correct |
16 |
Correct |
146 ms |
6508 KB |
Output is correct |
17 |
Correct |
140 ms |
6252 KB |
Output is correct |
18 |
Correct |
123 ms |
6252 KB |
Output is correct |
19 |
Correct |
374 ms |
11628 KB |
Output is correct |
20 |
Correct |
255 ms |
9324 KB |
Output is correct |
21 |
Correct |
400 ms |
12472 KB |
Output is correct |
22 |
Correct |
392 ms |
12396 KB |
Output is correct |