# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17470 | Namnamseo | Star triangles (IZhO11_triangle) | C++98 | 251 ms | 8116 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 <cstdio>
#include <algorithm>
using namespace std;
int cx[300010];
int cy[300010];
int px[300010];
int pxn;
int py[300010];
int pyn;
int n;
int x[300010];
int y[300010];
int main()
{
scanf("%d",&n);
int i;
for(i=0;i<n;++i){
scanf("%d%d",x+i,y+i);
px[i]=x[i]; py[i]=y[i];
}
sort(px,px+n); sort(py,py+n);
pxn=unique(px,px+n)-px;
pyn=unique(py,py+n)-py;
for(i=0;i<n;++i){
x[i]=lower_bound(px,px+pxn,x[i])-px;
y[i]=lower_bound(py,py+pyn,y[i])-py;
++cx[x[i]];
++cy[y[i]];
}
long long ans=0;
for(i=0;i<n;++i){
ans += (cx[x[i]]-1)*1ll*(cy[y[i]]-1);
}
printf("%lld\n",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |