# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
530921 | ohohorz | Star triangles (IZhO11_triangle) | C++14 | 239 ms | 20400 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 pii pair<int,int>
#define f first
#define s second
#define mp make_pair
#define pb push_back
const int N = 1e5 + 5;
const int INF = 1e18;
int x[N], y[N];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n;
cin>>n;
int ans = 0;
for(int i = 1;i <= n;i++){
cin >> x[i] >> y[i];
}
set< pii> se;
map<int,int> cntx, cnty;
map<pii, int> lol;
for(int i= 1;i <= n;i++){
cntx[x[i]] ++;
cnty[y[i]] ++;
lol[mp(x[i], y[i])] ++;
}
for(int i = 1;i <= n;i++){
// if(se.count(mp(x[i], y[i]))) continue;
int a = x[i], b = y[i];
// (a, b2)
// (a, b) (a2, b)
// find number of points such that x = a
// find number of points such that y = b
ans += ((cntx[a] - 1) * (cnty[b] - 1));
se.insert(mp(a, b));
}
cout <<ans<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |