Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
Markadiusz committed Sep 11, 2024
1 parent 160f696 commit b4fb78a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions code/data-structures/persistent-treap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* \texttt{insert(i, val)} insertuję na pozycję $i$,
* kopiowanie struktury działa w O(1),
* robimy sobie \texttt{vector<Treap>} żeby obsługiwać trwałość
* UPD. uwaga potencjalnie się kwadraci, spytać Bartka kiedy
*/
mt19937 rng_i(0);
struct Treap {
Expand Down
2 changes: 1 addition & 1 deletion code/graph/hld/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* \texttt{get\_subtree(v)} zwraca przedział preorderów odpowiadający podrzewu v.
*/
struct HLD {
// BEGIN HASH
// BEGIN HASH
vector<vector<int>> &adj;
vector<int> sz, pre, pos, nxt, par;
int t = 0;
Expand Down
6 changes: 3 additions & 3 deletions code/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
\usepackage[fontsize=9pt]{fontsize}
\kactlcontentdir{code}

\university{\textsf{University of Warsaw, Warsaw Eagles 2023}}{\textsf{University of Warsaw}}{uw}
\team{\textsf{Warsaw Eagles 2023}}{\textsf{Tomasz Nowak, Arkadiusz Czarkowski, Bartłomiej Czarkowski}}
\contest{\textsf{ICPC World Finals 2023}}{\textsf{\today}}
\university{\textsf{University of Warsaw, Warsaw Eagles 2024}}{\textsf{University of Warsaw}}{uw}
\team{\textsf{Warsaw Eagles 2024}}{\textsf{Tomasz Nowak, Arkadiusz Czarkowski, Bartłomiej Czarkowski}}
\contest{\textsf{ICPC World Finals 2024}}{\textsf{\today}}
% \enablecolors

\usepackage{fontspec}
Expand Down
8 changes: 8 additions & 0 deletions code/math/useful.tex
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,11 @@ \section{Zasada włączeń i wyłączeń}
W szczególności $S_0 = |X|$. Niech $D(k)$ oznacza liczbę elementów $X$ mających dokładnie $k$ własności.
$D(k) = \sum_{j\ge k}\binom{j}{k} \left(-1\right)^{j-k}S_j$
W szczególności $D(0) = \sum_{j \ge 0} \left(-1\right)^j S_j$

\section{Karp’s minimum mean-weight cycle algorithm}
$G = (V, E)$ - directed graph with weight function $w : E \to \mathbb{R}$
$n = |V|$
Assume that every vertex is reachable from $s \in V$.
$\delta_k(s, v)$ shortest $k$-path from $s$ to $v$ (simple dp)
Minimum mean-weight cycle is
$$ \min_{v\in V} \max_{0 \leq k \leq n-1} \frac{\delta_n(s, v) - \delta_k(s, v)}{n - k} $$
1 change: 1 addition & 0 deletions code/optimizations/chapter.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ \chapter{Optymalizacje}
\myimport{fio}
\myimport{knuth}
\myimport{linear-knapsack}
\myimport{matroid-intersection}
\myimport{pragmy}
\myimport{random}
\myimport{sos-dp}
7 changes: 4 additions & 3 deletions code/optimizations/matroid-intersection/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* Opis: Find largest subset S of [n] such that S is independent in both
* Opis: O(r^2 \cdot (init + n \cdot add)), where r is max independent set.
* Find largest subset S of [n] such that S is independent in both
* matroid A and B, given by their oracles, see example implementations below.
* Returns vector V such that V[i] = 1 iff i-th element is included in found set;
* Time: O(r^2 \cdot (init + n \cdot add)), where r is max independent set.
* Zabrane z https://github.com/KacperTopolski/kactl/tree/main
* Zmienne w matroidach ustawiamy ręcznie aby "zainicjalizować" tylko jeśli mają
* komentarz co znaczą. W przeciwnym wypadku intersectMatroids zrobi robotę wołając init.
*/

// BEGIN HASH
template<class T, class U>
vector<bool> intersectMatroids(T& A, U& B, int n) {
vector<bool> ans(n);
Expand Down Expand Up @@ -60,7 +61,7 @@ vector<bool> intersectMatroids(T& A, U& B, int n) {
}
}
return ans;
}
} // END HASH
// Matroid where each element has color
// and set is independent iff for each color c
// #{elements of color c} <= maxAllowed[c].
Expand Down

0 comments on commit b4fb78a

Please sign in to comment.