# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
899208 | pcc | Star triangles (IZhO11_triangle) | C++14 | 83 ms | 7972 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 pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e5+10;
map<int,int> xcnt,ycnt;
pii arr[mxn];
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
for(int i = 0;i<n;i++){
cin>>arr[i].fs>>arr[i].sc;
xcnt[arr[i].fs]++;
ycnt[arr[i].sc]++;
}
ll ans = 0;
for(int i = 0;i<n;i++){
ans += 1ll*(xcnt[arr[i].fs]-1)*(ycnt[arr[i].sc]-1);
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |