#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0) -> ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> x(n), y(n);
for(int i=0;i<n;i++)
{
cin >> x[i] >> y[i];
}
int ans = 0;
for(int i=0;i<n;i++)
{
int cx = 0, cy = 0;
for(int j=0;j<n;j++)
{
if(x[i] == x[j]) cx++;
if(y[i] == y[j]) cy++;
}
ans += (cx - 1) * (cy - 1);
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
312 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
320 KB |
Output is correct |
12 |
Correct |
186 ms |
520 KB |
Output is correct |
13 |
Correct |
95 ms |
592 KB |
Output is correct |
14 |
Correct |
113 ms |
588 KB |
Output is correct |
15 |
Execution timed out |
2064 ms |
1612 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |