summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2025-07-10 17:40:18 +0200
committermzuenni <michi.zuendorf@gmail.com>2025-07-10 17:40:18 +0200
commit630a5bdf06d59b8340fb4bfc0e692cbcf094026a (patch)
treeadee732c8d2cdcb46e5f400611c370b4c2ec1947 /content
parent609d5a3bf490cfa151b40e60cb62c8ff751bbe56 (diff)
run with sanitizer
Diffstat (limited to 'content')
-rw-r--r--content/graph/bitonicTSP.cpp2
-rw-r--r--content/graph/matching.cpp8
-rw-r--r--content/math/gcd-lcm.cpp2
-rw-r--r--content/math/piLehmer.cpp2
4 files changed, 6 insertions, 8 deletions
diff --git a/content/graph/bitonicTSP.cpp b/content/graph/bitonicTSP.cpp
index eee5082..f025bca 100644
--- a/content/graph/bitonicTSP.cpp
+++ b/content/graph/bitonicTSP.cpp
@@ -1,6 +1,6 @@
vector<vector<double>> dist; // Initialisiere mit Entfernungen zwischen Punkten.
-auto bitonicTSP() {
+auto bitonicTSP() { // n >= 2!
vector<double> dp(sz(dist), HUGE_VAL);
vector<int> pre(sz(dist)); // nur für Tour
dp[0] = 0; dp[1] = 2 * dist[0][1]; pre[1] = 0;
diff --git a/content/graph/matching.cpp b/content/graph/matching.cpp
index dcaea8c..1e450c0 100644
--- a/content/graph/matching.cpp
+++ b/content/graph/matching.cpp
@@ -1,4 +1,4 @@
-constexpr int MOD=1'000'000'007, I=10;
+constexpr int mod=1'000'000'007, I=10;
vector<vector<ll>> adj, mat;
int max_matching() {
@@ -9,10 +9,10 @@ int max_matching() {
mat[v].assign(sz(adj), 0);
for (int u : adj[v]) {
if (u < v) {
- mat[v][u] = rand() % (MOD - 1) + 1;
- mat[u][v] = MOD - mat[v][u];
+ mat[v][u] = rand() % (mod - 1) + 1;
+ mat[u][v] = mod - mat[v][u];
}}}
- gauss(sz(adj), MOD); //LGS @\sourceref{math/lgsFp.cpp}@
+ gauss(sz(mat), sz(mat[0])); //LGS @\sourceref{math/lgsFp.cpp}@
int rank = 0;
for (auto& row : mat) {
if (*max_element(all(row)) != 0) rank++;
diff --git a/content/math/gcd-lcm.cpp b/content/math/gcd-lcm.cpp
deleted file mode 100644
index a1c63c8..0000000
--- a/content/math/gcd-lcm.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
-ll lcm(ll a, ll b) {return a * (b / gcd(a, b));}
diff --git a/content/math/piLehmer.cpp b/content/math/piLehmer.cpp
index 17df85e..adef16d 100644
--- a/content/math/piLehmer.cpp
+++ b/content/math/piLehmer.cpp
@@ -6,7 +6,7 @@ ll memoC[N];
void init() {
primeSieve(); // @\sourceref{math/primeSieve.cpp}@
- for (ll i = 0; i < N; i++) {
+ for (ll i = 1; i < N; i++) {
memoC[i] = memoC[i - 1];
if (isPrime(i)) memoC[i]++;
}