#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define ft first
#define sc second
using namespace std;
const int mod=1e9+7,INF=1e17;
int a[300005],b[300005];
multiset<pair<int,int>> p;
map<int,int> m,m1;
main(){
ifstream fin("triangles.in");
ofstream fout("triangles.out");
int n,ans=0;
fin >> n;
for(int i=0;i<n;i++){
fin >> a[i] >> b[i];
p.insert({a[i],b[i]});
m[a[i]]++;
m1[b[i]]++;
}
for(auto x : p){
ans+=(m[x.ft]-1)*(m1[x.sc]-1);
}
fout << ans;
}
Compilation message
triangle.cpp:15:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
15 | main(){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |