# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870415 | boris_7 | Star triangles (IZhO11_triangle) | C++17 | 1 ms | 392 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |