//-------------dilanyan------------\\
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
//------------------KarginDefines--------------------\\
#define ll long long
#define pb push_back
#define all(u) (u).begin(), (u).end()
#define pqueue priority_queue
#define upper upper_bound
#define lower lower_bound
#define umap unordered_map
#define uset unordered_setq
#define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout);
//-------------------KarginConstants------------------\\
const ll mod = 1000000007;
const ll inf = 1e9;
//-------------------KarginCode------------------------\\
const int N = 300005;
int x[N], y[N];
map<int, ll> mx, my;
void KarginSolve() {
int n; cin >> n;
for (int i = 0; i < n;i++) {
cin >> x[i] >> y[i];
mx[x[i]]++, my[y[i]]++;
}
ll ans = 0;
for (int i = 0;i < n;i++) ans += (mx[x[i]] - 1) * (my[y[i]] - 1);
cout << ans << '\n';
}
int main() {
// Usaco
Kargin;
int test = 1;
//cin >> test;
while (test--) {
KarginSolve();
}
return 0;
}
// There is nothing we can do
Compilation message
triangle.cpp:1:1: warning: multi-line comment [-Wcomment]
1 | //-------------dilanyan------------\\
| ^
triangle.cpp:8:1: warning: multi-line comment [-Wcomment]
8 | //------------------KarginDefines--------------------\\
| ^
triangle.cpp:22:1: warning: multi-line comment [-Wcomment]
22 | //-------------------KarginConstants------------------\\
| ^
triangle.cpp:27:1: warning: multi-line comment [-Wcomment]
27 | //-------------------KarginCode------------------------\\
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2648 KB |
Output is correct |
6 |
Correct |
1 ms |
2392 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2392 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
3208 KB |
Output is correct |
13 |
Correct |
7 ms |
3164 KB |
Output is correct |
14 |
Correct |
8 ms |
3676 KB |
Output is correct |
15 |
Correct |
84 ms |
8724 KB |
Output is correct |
16 |
Correct |
91 ms |
8924 KB |
Output is correct |
17 |
Correct |
96 ms |
8740 KB |
Output is correct |
18 |
Correct |
96 ms |
8736 KB |
Output is correct |
19 |
Correct |
227 ms |
12628 KB |
Output is correct |
20 |
Correct |
168 ms |
10948 KB |
Output is correct |
21 |
Correct |
251 ms |
13396 KB |
Output is correct |
22 |
Correct |
246 ms |
13348 KB |
Output is correct |