#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
map <int, int> x, y;
vector<pair<int, int>> queries;
for(int i=0;i<n;i++){
int X, Y;
cin>>X>>Y;
queries.push_back({X, Y});
x[X]++;
y[Y]++;
}
long long q=0;
for(int i=0;i<n;i++){
q+=(x[queries[i].first]-1)*(y[queries[i].second]-1);
}
cout<<q;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 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 |
344 KB |
Output is correct |
12 |
Correct |
8 ms |
1116 KB |
Output is correct |
13 |
Correct |
9 ms |
1040 KB |
Output is correct |
14 |
Correct |
12 ms |
1376 KB |
Output is correct |
15 |
Correct |
125 ms |
6112 KB |
Output is correct |
16 |
Correct |
135 ms |
6340 KB |
Output is correct |
17 |
Correct |
124 ms |
6084 KB |
Output is correct |
18 |
Correct |
125 ms |
6028 KB |
Output is correct |
19 |
Correct |
341 ms |
13296 KB |
Output is correct |
20 |
Correct |
260 ms |
8824 KB |
Output is correct |
21 |
Correct |
367 ms |
13236 KB |
Output is correct |
22 |
Correct |
391 ms |
12656 KB |
Output is correct |