#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<pair<int, int>>p(n);
map<int, int>X, Y;
for(int i = 0;i < n;++i){
cin >> p[i].second >> p[i].first;
X[p[i].second]++;
Y[p[i].first]++;
}
sort(p.begin(), p.end());
int result = 0;
for(int i = 0;i < n;++i){
if(Y[p[i].first] < 2)continue;
Y[p[i].first]--;
for(int j = i + 1;j < n;++j){
if(p[i].first == p[j].first)result += X[p[i].second] + X[p[j].second] - 2;
}
}
cout << result;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
340 KB |
Output is correct |
11 |
Correct |
5 ms |
340 KB |
Output is correct |
12 |
Correct |
10 ms |
852 KB |
Output is correct |
13 |
Correct |
705 ms |
844 KB |
Output is correct |
14 |
Correct |
19 ms |
1108 KB |
Output is correct |
15 |
Execution timed out |
2088 ms |
3948 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |