#include <bits/stdc++.h>
using namespace std;
int
main(void)
{
int n;
cin >> n;
vector<int> x(n), y(n);
map<int,int> cntx, cnty;
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i];
cntx[x[i]]++;
cnty[y[i]]++;
}
long long ans = 0;
for(int i = 0; i < n; i++)
ans += (cntx[x[i]]-1) * (long long)(cnty[y[i]]-1);
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
9 ms |
1116 KB |
Output is correct |
13 |
Correct |
10 ms |
1116 KB |
Output is correct |
14 |
Correct |
14 ms |
1372 KB |
Output is correct |
15 |
Correct |
126 ms |
6228 KB |
Output is correct |
16 |
Correct |
151 ms |
6492 KB |
Output is correct |
17 |
Correct |
129 ms |
6240 KB |
Output is correct |
18 |
Correct |
127 ms |
6148 KB |
Output is correct |
19 |
Correct |
365 ms |
11536 KB |
Output is correct |
20 |
Correct |
259 ms |
9296 KB |
Output is correct |
21 |
Correct |
390 ms |
12380 KB |
Output is correct |
22 |
Correct |
379 ms |
12112 KB |
Output is correct |