# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976478 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 281 ms | 13208 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;
#define ll long long
#define pb push_back
#define pll pair<ll,ll>
const ll MOD=1e9+7;
//#define ll int
//KALAU TAKUT RTE
bool cmp (pair<ll,ll> x, pair<ll,ll>y){
return x.second < y.second;
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n; cin>>n;
ll x[n+1], y[n+1];
map<ll,ll> cntx, cnty;
for (int i=1; i<=n;i++){
cin>>x[i]>>y[i];
cntx[x[i]]++; cnty[y[i]]++;
}
ll ans=0;
for (int i=1; i<=n;i++){
ans+= (cntx[x[i]]-1) * (cnty[y[i]]-1);
}
cout<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |