# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134148 | huisung | Star triangles (IZhO11_triangle) | C++14 | 711 ms | 13320 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 FOR(i,a,b) for(int i=int(a);i<=int(b);i++)
#define ROF(i,a,b) for(int i=int(b);i>=int(a);i--)
#define pb push_back
#define pq priority_queue
#define ps push
using namespace std;
struct point{int x,y;};
int n;
point in[300010];
long long anw;
map<int,long long> sero,garo;
int main(){
cin>>n;
FOR(i,1,n){
scanf("%d %d",&in[i].x,&in[i].y);
if(sero.find(in[i].y)==sero.end()) sero[in[i].y]=1;
else sero[in[i].y]++;
if(garo.find(in[i].x)==garo.end()) garo[in[i].x]=1;
else garo[in[i].x]++;
}
FOR(i,1,n) anw+=((garo[in[i].x]-1)*(sero[in[i].y]-1));
cout<<anw;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |