diff --git a/content/various/chapter.tex b/content/various/chapter.tex index 7d24c74..4c09178 100644 --- a/content/various/chapter.tex +++ b/content/various/chapter.tex @@ -3,6 +3,10 @@ \chapter{Various} \kactlimport{GaussianElimination.hpp} \kactlimport{BinaryTrie.hpp} \kactlimport{InfixPropostfix.hpp} +\kactlinport{xor_range.hpp} + +\section{LP Duality} + \import{lp_dual.tex} \section{Optimization tricks} \verb@__builtin_ia32_ldmxcsr(40896);@ disables denormals (which make floats 20x slower near their minimum value). diff --git a/content/various/lp_dual.tex b/content/various/lp_dual.tex new file mode 100644 index 0000000..dc22c2f --- /dev/null +++ b/content/various/lp_dual.tex @@ -0,0 +1,10 @@ +\begin{tabular}{c|c} +Maximization & Minimization \\ +\hline +Inequality constraint $\le$ & Nonnegative variable $\ge$ \\ +Inequality constraint $\ge$ & Nonpositive variable $\le$ \\ +Equality constraint $=$ & Free variable \\ +Nonnegative variable $\ge$ & Inequality constraint $\ge$ \\ +Nonpositive variable $\le$ & Inequality constraint $\le$ \\ +Free variable & Equality constraint $=$ \\ +\end{tabular} \ No newline at end of file diff --git a/content/various/xor_range.hpp b/content/various/xor_range.hpp new file mode 100644 index 0000000..1ec8166 --- /dev/null +++ b/content/various/xor_range.hpp @@ -0,0 +1,26 @@ +#pragma once + +/** + * Author: Teetat T. + * Date: 2024-11-27 + * Description: find all range of $x$ such that $l \le x$ xor $p < r$. + */ + +template +void xor_range(ll p,ll l,ll r,const F &query){ + for(int i=0;i<60;i++){ + if(l==r)break; + ll b=1LL<