# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152594 | beso123 | Star triangles (IZhO11_triangle) | C++14 | 1024 ms | 18600 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>
#define int long long
#define pii pair<int,int>
#define x first
#define y second
using namespace std;
int n,ans;
map <int,int> x,y;
vector <pii> v;
main(){
cin>>n;
for(int k=1;k<=n;k++){
int a,b;
cin>>a>>b;
x[a]++;
y[b]++;
v.push_back(make_pair(a,b));
}
for(int k=0;k<v.size();k++){
int a=v[k].x,b=v[k].y;
int p1=x[a]-1,p2=y[b]-1;
ans+=(p1*p2);
}
cout<<ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |