#include <bits/stdc++.h>
#define ss second
#define ff first
using namespace std;
const int N=3e5+10;
int n, x[N], y[N], ans;
map<int, int> fx, fy;
main(){
cin>>n;
for(int i=0; i<n; i++){
cin>>x[i]>>y[i];
fx[x[i]]++;
fy[y[i]]++;
}
for(int i=0; i<n; i++){
ans+=(fx[x[i]]-1)*(fy[y[i]]-1);
}
cout<<ans<<endl;
}
Compilation message
triangle.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main(){
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
376 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
3 ms |
364 KB |
Output is correct |
12 |
Correct |
15 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1132 KB |
Output is correct |
14 |
Correct |
18 ms |
1516 KB |
Output is correct |
15 |
Correct |
200 ms |
6252 KB |
Output is correct |
16 |
Correct |
229 ms |
6508 KB |
Output is correct |
17 |
Correct |
240 ms |
6252 KB |
Output is correct |
18 |
Correct |
195 ms |
6252 KB |
Output is correct |
19 |
Correct |
671 ms |
11628 KB |
Output is correct |
20 |
Correct |
445 ms |
9324 KB |
Output is correct |
21 |
Correct |
625 ms |
12396 KB |
Output is correct |
22 |
Correct |
652 ms |
12140 KB |
Output is correct |