# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870412 | boris_7 | Star triangles (IZhO11_triangle) | C++17 | 1 ms | 348 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 ("triangle.in","r",stdin);
freopen ("triangle.out","w",stdout);
int n;
cin>>n;
map<ll,ll>x,y;
for(int i = 0;i<n;i++){
int 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);
// int t;cin>>t;while(t--)
solve();
}/*
Yes
Yes
No
Yes
Yes
No
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |