#include <bits/stdc++.h>
using namespace std;
pair <long long, long long> x[300001];
long long n, xi, yi, ans;
int main(){
cin >> n;
for (int i = 0; i < n; i++){
cin >> x[i].first >> x[i].second;
}
sort(x, x+n);
for (int i = 0; i < n; i++){
xi = 0;
yi = 0;
for (int j = 0; j < n; j++){
if(x[i].first == x[j].first && x[i].second == x[j].second){
continue;
} else {
if (x[i].first == x[j].first){
xi++;
}
if (x[i].second == x[j].second){
yi++;
}
}
}
ans += xi * yi;
}
cout << ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
444 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 |
444 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
79 ms |
504 KB |
Output is correct |
13 |
Correct |
80 ms |
600 KB |
Output is correct |
14 |
Correct |
80 ms |
604 KB |
Output is correct |
15 |
Execution timed out |
2066 ms |
4572 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |