#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
// freopen ("triangles.in","r",stdin);
// freopen ("triangles.out","w",stdout);
ll n;
cin>>n;
map<ll,ll>x,y;
for(ll i = 0;i<n;i++){
ll a,b;
cin>>a>>b;
x[a]++;
y[b]++;
}
ll ans = 0;
for(pair<ll,ll> i :x){
for(pair<ll,ll>j:y){
ans+=(i.second-1)*(j.second-1);
}
}
cout<<ans<<endl;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
// ll t;cin>>t;while(t--)
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 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 |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
392 KB |
Output is correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |