-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteamnote.tex
More file actions
216 lines (161 loc) · 6.17 KB
/
teamnote.tex
File metadata and controls
216 lines (161 loc) · 6.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
\documentclass[9pt,landscape,a4paper,twocolumn]{extarticle}
\setlength{\columnsep}{5pt}
\usepackage[left=0.2cm, right=0.2cm, top=1cm, bottom=1.2cm, headsep=0.2cm]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fontspec}
\usepackage{kotex}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{listings}
\usepackage{comment}
\usepackage{import}
\usepackage{wrapfig}
\usepackage{url}
\usepackage{array}
\usepackage{titlesec}
\usepackage[normal]{engord}
\usepackage[svgnames,table]{xcolor}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[R]{\thepage}
\fancyhead[L]{KU - unipass}
\setmonofont[
BoldFont = consolab.ttf,
ItalicFont = consolai.ttf
]{consola.ttf}
\setmainhangulfont{NanumMyeongjo}
\setlength\parindent{0pt}
\usepackage[parfill]{parskip}
\setlength\parskip{0pt}
\setlength\baselineskip{0pt}
\titlespacing*{\section}{0pt}{0pt}{0pt}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}
\definecolor{dkgrey}{RGB}{127, 127, 127}
\lstset{
basicstyle=\footnotesize\ttfamily,
breaklines=true,
breakindent=1.1em
% numbers=left,
% numberstyle=\footnotesize\ttfamily\color{dkgrey},
% numbersep=5pt
% frame=trbl
}
\lstdefinestyle{mycpp}{
language=[GNU]C++,
keywordstyle=\color{blue},
commentstyle=\itshape\color{purple!40!black},
stringstyle=\color{orange},
}
\lstdefinestyle{myjava}{
language=Java,
keywordstyle=\color{blue},
commentstyle=\itshape\color{purple!40!black},
stringstyle=\color{orange},
}
\begin{document}
\tableofcontents
\newpage
\newpage
\section{Setting}
\subsection{Default code}
\lstinputlisting[style=mycpp]{src/setting/default-code.cpp}
\section{Math}
\subsection{Extended Euclidean Algorithm}
\lstinputlisting[style=mycpp]{src/math/extended-euclidean.cpp}
\subsection{Primality Test}
\lstinputlisting[style=mycpp]{src/math/primality-test.cpp}
\subsection{Integer Factorization (Pollard's rho)}
\lstinputlisting[style=mycpp]{src/math/pollard-rho.cpp}
\subsection{Chinese Remainder Theorem}
\lstinputlisting[style=mycpp]{src/math/crt.cpp}
\subsection{Query of nCr mod M in $O(Q+M)$}
\lstinputlisting[style=mycpp]{src/math/binomial.cpp}
\subsection{pelindrome number}
\lstinputlisting[style=mycpp]{src/math/pelindrome.cpp}
\subsection{Matrix Pow}
\lstinputlisting[style=mycpp]{src/math/matrix-mul-pow.cpp}
\subsection{Catalan, Derangement, Partition, 2nd Stirling}
$C_n = \frac{1}{n + 1} \binom{2n}{n}, C_0 = 1, C_{n + 1} = \sum_{i=0}^{n} C_i C_{n-i}, C_{n + 1} = \frac{2(2n+1)}{n+2} C_n$
$D_n = (n-1)(D_{n-1} + D_{n-2})=n! \sum_{i=1}^n \frac{(-1)^{i+1}}{i!}$
$ P(n) =\sum_{k \in \mathbb{Z}\setminus\{0\}}^{}
(-1)^{k+1} P(n-k(3k-1)/2) $
$= P(n-1) + P(n-2)-P(n-5)-P(n-7) +P(n-12) +P(n-15) - P(n-22) -\cdots$
$P(n,k)=P(n-1,k-1)+P(n-k,k)$, $S(n,k)=S(n-1,k-1)+k\cdot S(n-1,k)$
\subsection{Matrix Operations}
\lstinputlisting[style=mycpp]{src/math/matrix-operations.cpp}
\subsection{Gaussian Elimination}
\lstinputlisting[style=mycpp]{src/math/gaussian.cpp}
\subsection{Permutation and Combination}
\lstinputlisting[style=mycpp]{src/math/permutation.cpp}
\lstinputlisting[style=mycpp]{src/math/combination.cpp}
\subsection{Integer Partition}
\lstinputlisting[style=mycpp]{src/math/integer-partition.cpp}
\subsection{Xudyh's Sieve}
\lstinputlisting[style=mycpp]{src/math/xudyh-sieve.cpp}
\subsection{Lifting The Exponent}
For any integers $x$, $y$ a positive integer $n$, and a prime number $p$ such that $p \nmid x$ and $p \nmid y$, the following statements hold:
\begin{itemize}
\item When $p$ is odd:
\begin{itemize}
\item If $p \mid x-y$, then $\nu_p(x^n-y^n) = \nu_p(x-y)+\nu_p(n)$.
\item If $n$ is odd and $p \mid x+y$, then $\nu_p(x^n+y^n) = \nu_p(x+y)+\nu_p(n)$.
\end{itemize}
\item When $p = 2$:
\begin{itemize}
\item If $2 \mid x-y$ and $n$ is even, then $\nu_2(x^n-y^n) = \nu_2(x-y)+\nu_2(x+y)+\nu_2(n)-1$.
\item If $2 \mid x-y$ and $n$ is odd, then $\nu_2(x^n-y^n) = \nu_2(x-y)$.
\item Corollary:
\begin{itemize}
\item If $4 \mid x-y$, then $\nu_2(x+y)=1$ and thus $\nu_2(x^n-y^n) = \nu_2(x-y)+\nu_2(n)$.
\end{itemize}
\end{itemize}
\item For all $p$:
\begin{itemize}
\item If $\gcd(n,p) = 1$ and $p \mid x-y$, then $\nu_p(x^n-y^n) = \nu_p(x-y)$.
\item If $\gcd(n,p) = 1$, $p \mid x+y$ and $n$ odd, then $\nu_p(x^n+y^n) = \nu_p(x+y)$.
\end{itemize}
\end{itemize}
\section{Data Structure}
\subsection{Lazy Segment Tree}
\lstinputlisting[style=mycpp]{src/data-structure/lazy-segment-tree.cpp}
\subsection{Persistent Segment Tree}
\lstinputlisting[style=mycpp]{src/data-structure/persistent-segment-tree.cpp}
\subsection{Strongly Connected Component}
\lstinputlisting[style=mycpp]{src/data-structure/scc.cpp}
\subsection{Fenwick Tree}
\lstinputlisting[style=mycpp]{src/data-structure/fenwick-tree.cpp}
\section{DP}
\subsection{LIS}
\lstinputlisting[style=mycpp]{src/dp/lis.cpp}
\section{Graph}
\subsection{Dijkstra}
\lstinputlisting[style=mycpp]{src/graph/dijkstra.cpp}
\subsection{LCA}
\lstinputlisting[style=mycpp]{src/graph/lca.cpp}
\subsection{Centroid Decomposition}
\lstinputlisting[style=mycpp]{src/graph/centroid-decomposition.cpp}
\subsection{Minimum Spanning Tree}
\lstinputlisting[style=mycpp]{src/graph/mst.cpp}
\subsection{Offline Dynamic Connectivity}
\lstinputlisting[style=mycpp]{src/graph/offline-dynamic-connectivity.cpp}
\section{String}
\subsection{KMP}
\lstinputlisting[style=mycpp]{src/string/kmp.cpp}
\subsection{Z Algorithm}
\lstinputlisting[style=mycpp]{src/string/z.cpp}
\subsection{LCS}
\lstinputlisting[style=mycpp]{src/string/lcs.cpp}
\subsection{Trie}
\lstinputlisting[style=mycpp]{src/string/trie.cpp}
\section{Geometry}
\subsection{CCW}
\lstinputlisting[style=mycpp]{src/geometry/ccw.cpp}
\subsection{Line Intersection}
\lstinputlisting[style=mycpp]{src/geometry/line-intersection.cpp}
\subsection{Point in Nonconvex Polygon}
\lstinputlisting[style=mycpp]{src/geometry/point-in-nonconvex-polygon.cpp}
\section{Hash}
\subsection{Basic Hash}
\lstinputlisting[style=mycpp]{src/hash/basic-hash.cpp}
\end{document}