# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
638855 | MohamedAhmed04 | Star triangles (IZhO11_triangle) | C++14 | 268 ms | 12108 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 ;
const int MAX = 3e5 + 10 ;
int arr[MAX] ;
int n ;
int X[MAX] , Y[MAX] ;
map<int , int>mpx , mpy ;
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
cin>>n ;
for(int i = 0 ; i < n ; ++i)
cin>>X[i]>>Y[i] ;
for(int i = 0 ; i < n ; ++i)
mpx[X[i]]++ , mpy[Y[i]]++ ;
long long ans = 0 ;
for(int i = 0 ; i < n ; ++i)
ans += 1ll * (mpx[X[i]]-1ll) * (mpy[Y[i]]-1ll) ;
return cout<<ans<<"\n" , 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |