diff options
| author | MZuenni <michi.zuendorf@gmail.com> | 2023-03-01 16:56:27 +0100 |
|---|---|---|
| committer | MZuenni <michi.zuendorf@gmail.com> | 2023-03-01 16:56:27 +0100 |
| commit | b15088d04aac27a3ef94cf79e68d681d735b1bbc (patch) | |
| tree | 96ba00e474790acd62d10a5d1ae5699e42cf6b4c | |
| parent | d8eefacaebee4e08aa92ae507d49079d90a93580 (diff) | |
reformatted empty lines
| -rw-r--r-- | datastructures/LCT.cpp | 30 | ||||
| -rw-r--r-- | datastructures/unionFind2.cpp | 4 | ||||
| -rw-r--r-- | graph/TSP.cpp | 4 | ||||
| -rw-r--r-- | graph/bellmannFord.cpp | 2 | ||||
| -rw-r--r-- | graph/connect.cpp | 8 | ||||
| -rw-r--r-- | math/transforms/fftMul.cpp | 2 | ||||
| -rw-r--r-- | tests/test.tex | 4 |
7 files changed, 27 insertions, 27 deletions
diff --git a/datastructures/LCT.cpp b/datastructures/LCT.cpp index b67ab82..9adae89 100644 --- a/datastructures/LCT.cpp +++ b/datastructures/LCT.cpp @@ -34,17 +34,17 @@ struct LCT { bool revert; int id, size; Node *left, *right, *parent; - + Node(int id = 0, int val = queryDefault) : nodeValue(val), subTreeValue(val), delta(updateDefault), revert(false), id(id), size(1), left(nullptr), right(nullptr), parent(nullptr) {} - + bool isRoot() { return !parent || (parent->left != this && parent->right != this); } - + void push() { if (revert) { revert = false; @@ -63,7 +63,7 @@ struct LCT { ll getSubtreeValue() { return joinValueDelta(subTreeValue, _update(delta, size)); } - + void update() { subTreeValue = joinValueDelta(nodeValue, delta); size = 1; @@ -78,13 +78,13 @@ struct LCT { size += right->size; }} }; - + vector<Node> nodes; - + LCT(int n) : nodes(n) { for (int i = 0; i < n; i++) nodes[i].id = i; } - + void connect(Node* ch, Node* p, int isLeftChild) { if (ch) ch->parent = p; if (isLeftChild >= 0) { @@ -103,7 +103,7 @@ struct LCT { connect(x, g, isRootP ? -1 : p == g->left); p->update(); } - + void splay(Node* x) { while (!x->isRoot()) { Node* p = x->parent; @@ -118,7 +118,7 @@ struct LCT { x->push(); x->update(); } - + Node* expose(Node* x) { Node* last = nullptr; for (Node* y = x; y; y = y->parent) { @@ -129,25 +129,25 @@ struct LCT { splay(x); return last; } - + void makeRoot(Node* x) { expose(x); x->revert ^= 1; } - + bool connected(Node* x, Node* y) { if (x == y) return true; expose(x); expose(y); return x->parent; } - + void link(Node* x, Node* y) { assert(!connected(x, y)); // not yet connected! makeRoot(x); x->parent = y; } - + void cut(Node* x, Node* y) { makeRoot(x); expose(y); @@ -162,14 +162,14 @@ struct LCT { expose(x); return expose(y); } - + ll query(Node* from, Node* to) { makeRoot(from); expose(to); if (to) return to->getSubtreeValue(); return queryDefault; } - + void modify(Node* from, Node* to, ll delta) { makeRoot(from); expose(to); diff --git a/datastructures/unionFind2.cpp b/datastructures/unionFind2.cpp index b86c8e0..5362c4d 100644 --- a/datastructures/unionFind2.cpp +++ b/datastructures/unionFind2.cpp @@ -9,7 +9,7 @@ int findSet(int i) { uf[i] = findSet(uf[i]); //Path-Compression return uf[i]; } - + void linkSets(int i, int j) { //Take |uf[i]|, where i must be a root, to get the size //of the subset @@ -19,7 +19,7 @@ void linkSets(int i, int j) { uf[i] += uf[j]; uf[j] = i; } } - + void unionSets(int i, int j) { if(findSet(i) != findSet(j)) linkSets(findSet(i),findSet(j)); } diff --git a/graph/TSP.cpp b/graph/TSP.cpp index e0fced6..cfb1b4d 100644 --- a/graph/TSP.cpp +++ b/graph/TSP.cpp @@ -3,7 +3,7 @@ vector<vector<ll>> dist; // Entfernung zwischen je zwei Punkten. void TSP() { int n = sz(dist), m = 1 << n; vector<vector<edge>> dp(n, vector<edge>(m, edge{INF, -1})); - + for (int c = 0; c < n; c++) dp[c][m-1].dist = dist[c][0], dp[c][m-1].to = 0; @@ -18,7 +18,7 @@ void TSP() { dp[c][v].to = g; }}}}} // return dp[0][1]; // Länge der Tour - + vector<int> tour; tour.push_back(0); int v = 0; while (tour.back() != 0 || sz(tour) == 1) tour.push_back(dp[tour.back()] diff --git a/graph/bellmannFord.cpp b/graph/bellmannFord.cpp index 785a42d..7ba51c0 100644 --- a/graph/bellmannFord.cpp +++ b/graph/bellmannFord.cpp @@ -1,7 +1,7 @@ void bellmannFord(int n, vector<edge> edges, int start) { vector<ll> dist(n, INF), parent(n, -1); dist[start] = 0; - + for (int i = 1; i < n; i++) { for (edge& e : edges) { if (dist[e.from] != INF && diff --git a/graph/connect.cpp b/graph/connect.cpp index b25d844..a7b2811 100644 --- a/graph/connect.cpp +++ b/graph/connect.cpp @@ -2,13 +2,13 @@ struct connect { int n; vector<pair<int, int>> edges; LCT lct; // min LCT no updates required - + connect(int n, int m) : n(n), edges(m), lct(n+m) {} - + bool connected(int a, int b) { return lct.connected(&lct.nodes[a], &lct.nodes[b]); } - + void addEdge(int a, int b, int id) { lct.nodes[id + n] = LCT::Node(id + n, id + n); edges[id] = {a, b}; @@ -20,7 +20,7 @@ struct connect { lct.link(&lct.nodes[a], &lct.nodes[id + n]); lct.link(&lct.nodes[b], &lct.nodes[id + n]); }} - + void eraseEdge(ll id) { if (connected(edges[id].first, edges[id].second) && lct.query(&lct.nodes[edges[id].first], diff --git a/math/transforms/fftMul.cpp b/math/transforms/fftMul.cpp index a1205f6..542404e 100644 --- a/math/transforms/fftMul.cpp +++ b/math/transforms/fftMul.cpp @@ -9,6 +9,6 @@ vector<cplx> mul(vector<cplx>& a, vector<cplx>& b) { cplx x = (c[i] + conj(c[j])) / cplx{2, 0}; //fft(a)[i]; cplx y = (c[i] - conj(c[j])) / cplx{0, 2}; //fft(b)[i]; d[i] = x * y; - } + } return fft(d, true); } diff --git a/tests/test.tex b/tests/test.tex index 08b80b3..3e5f19b 100644 --- a/tests/test.tex +++ b/tests/test.tex @@ -9,11 +9,11 @@ Dieser Abschnitt enthält lediglich Dinge die während der Practicesession getes \end{itemize} \sourcecode{tests/gcc5bug.cpp} \begin{itemize} - \item funktioniert \code{\_\_int128}? + \item funktioniert \code{__int128}? \item funktionieren Pragmas? \item funktionieren \code{constexpr} zur Compilezeit (+Zeitlimit)? \item wie groß ist \code{sizeof(char*)}? - \item wie groß ist \code{RAND\_MAX}? + \item wie groß ist \code{RAND_MAX}? \item funktioniert \code{random_device}? (und gib es unerschiedliche Ergebnisse?) \item funktioniert \code{clock()}? \end{itemize} |
