# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
707034 | ToroTN | Star triangles (IZhO11_triangle) | C++14 | 586 ms | 32204 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 X first
#define Y second
#define mpr make_pair
ll n,x[300005],y[30005],cnt=0,num,xx,yy;
map<ll,ll> mp1,mp2;
map<pair<ll,ll>,ll> mp;
map<pair<ll,ll>,ll> :: iterator it;
int main()
{
scanf("%lld",&n);
for(int i=1;i<=n;i++)
{
scanf("%lld%lld",&x[i],&y[i]);
++mp1[x[i]],++mp2[y[i]];
++mp[mpr(x[i],y[i])];
}
for(it=mp.begin();it!=mp.end();it++)
{
num=(*it).Y;
xx=(*it).X.X;
yy=(*it).X.Y;
cnt+=(mp1[xx]-num)*(mp2[yy]-num)*num;
}
printf("%lld\n",cnt);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |