MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / pt

Class pt

code/data-structures/kd_tree.cpp:3–10  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#define INC(c) ((c) == K - 1 ? 0 : (c) + 1)
2template <int K> struct kd_tree {
3 struct pt {
4 double coord[K];
5 pt() {}
6 pt(double c[K]) { rep(i,0,K) coord[i] = c[i]; }
7 double dist(const pt &other) const {
8 double sum = 0.0;
9 rep(i,0,K) sum += pow(coord[i] - other.coord[i], 2.0);
10 return sqrt(sum); } };
11 struct cmp {
12 int c;
13 cmp(int _c) : c(_c) {}

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by 1

testFunction · 0.68