From ed4f762c7791b041bd013a3155cf775a9af61c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Renison?= <85908989+IvanRenison@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:02:00 -0300 Subject: [PATCH] Shorten some lines that where to long --- content/graph/EdmondsKarp.h | 3 ++- content/numerical/MatrixInverse-mod.h | 5 +++-- content/numerical/NumberTheoreticTransform.h | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/content/graph/EdmondsKarp.h b/content/graph/EdmondsKarp.h index 317000228..ba81384eb 100644 --- a/content/graph/EdmondsKarp.h +++ b/content/graph/EdmondsKarp.h @@ -9,7 +9,8 @@ */ #pragma once -template T edmondsKarp(vector>& graph, int source, int sink) { +template T edmondsKarp(vector>& + graph, int source, int sink) { assert(source != sink); T flow = 0; vi par(sz(graph)), q = par; diff --git a/content/numerical/MatrixInverse-mod.h b/content/numerical/MatrixInverse-mod.h index 3580cfeee..37f6f9d25 100644 --- a/content/numerical/MatrixInverse-mod.h +++ b/content/numerical/MatrixInverse-mod.h @@ -26,7 +26,8 @@ int matInv(vector>& A) { return i; found: A[i].swap(A[r]); tmp[i].swap(tmp[r]); - rep(j,0,n) swap(A[j][i], A[j][c]), swap(tmp[j][i], tmp[j][c]); + rep(j,0,n) + swap(A[j][i], A[j][c]), swap(tmp[j][i], tmp[j][c]); swap(col[i], col[c]); ll v = modpow(A[i][i], mod - 2); rep(j,i+1,n) { @@ -46,6 +47,6 @@ int matInv(vector>& A) { } rep(i,0,n) rep(j,0,n) - A[col[i]][col[j]] = tmp[i][j] % mod + (tmp[i][j] < 0 ? mod : 0); + A[col[i]][col[j]] = tmp[i][j] % mod + (tmp[i][j] < 0)*mod; return n; } diff --git a/content/numerical/NumberTheoreticTransform.h b/content/numerical/NumberTheoreticTransform.h index ff2b2573a..e59ba7e8a 100644 --- a/content/numerical/NumberTheoreticTransform.h +++ b/content/numerical/NumberTheoreticTransform.h @@ -42,12 +42,14 @@ void ntt(vl &a) { } vl conv(const vl &a, const vl &b) { if (a.empty() || b.empty()) return {}; - int s = sz(a) + sz(b) - 1, B = 32 - __builtin_clz(s), n = 1 << B; + int s = sz(a) + sz(b) - 1, B = 32 - __builtin_clz(s), + n = 1 << B; int inv = modpow(n, mod - 2); vl L(a), R(b), out(n); L.resize(n), R.resize(n); ntt(L), ntt(R); - rep(i,0,n) out[-i & (n - 1)] = (ll)L[i] * R[i] % mod * inv % mod; + rep(i,0,n) + out[-i & (n - 1)] = (ll)L[i] * R[i] % mod * inv % mod; ntt(out); return {out.begin(), out.begin() + s}; }