# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987149 | ezzzay | Star triangles (IZhO11_triangle) | C++14 | 12 ms | 14684 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 int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
vector<int>v[N];
signed main(){
int n;
cin>>n;
map<int,int>mpx,mpy;
for(int i=1;i<=n;i++){
int x,y;
cin>>x>>y;
mpx[x]++;
mpy[y]++;
v[x].pb(y);
}
int cnt=0;
for(auto it=mpx.begin();it!=mpx.end();it++){
int x= it->ff;
for(auto y:v[x]){
cnt+= (mpy[y]-1)*(mpx[x]-1);
}
}
cout<<cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |