-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompetitive.tex
181 lines (126 loc) · 3.23 KB
/
competitive.tex
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
\documentclass{article}
% NOTES:
%
% https://atcoder.jp/contests/abc222/editorial/2749
% E Sum of Geometric Progression in O(log(N))
%
% TO PRINT:
% Kirhov's Theorem
% Picks Theorem for Polygon area
\usepackage{listings}
\usepackage{color}
\usepackage{multicol}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage[margin=1in]{geometry}
\usepackage{import}
\usepackage{minted}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=c++,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
\lstdefinestyle{smaller_code}{
language=c++,
}
\title{\textbf{Competitive Programming Library}}
\author{Collection by Mitko Nikov}
\date{\today}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{proof}{Proof}
\newtheorem{remark}{Remark}
\newtheorem{problem}{Problem}
\begin{document}
\maketitle
\newpage
\vspace*{\fill}
\begin{center}
Intentionally left blank.
\end{center}
\vspace*{\fill}
\newpage
\tableofcontents
\newpage
\section{Foreword}
Dear Reader, I collected this set of algorithms and data structures from various sources
over the years and now is the time to give it all to the world. This collection of algorithms
and data structures contains some very well known ones, but also some that are so specific, that
they have a single use case only.
Some of the algorithms, for shorter code use the following template:
\begin{lstlisting}
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(c) ((c).begin()), ((c).end())
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
\end{lstlisting}
Always try to do the following checks before submitting a problem:
\begin{itemize}
\item Edge cases?
\item Overflows?
\item Memory allocation (MLE)?
\item Out-of-bounds on array access?
\item Did you escape all characters?
\item Recursion depth, stack memory?
\end{itemize}
\noindent \hrulefill
\textbf{I dedicate this book to You - all of the people that work hard, even if they know
that they will never be appreciated for what they have accomplished or what they tried to achieve.}
\section{Graphs}
\import{./Graphs}{index.tex}
\newpage
\section{Trees}
\import{./Trees}{index.tex}
\newpage
\section{Algorithms}
\import{./Algorithms}{index.tex}
\newpage
\section{String Algorithms}
\import{./Strings}{index.tex}
\newpage
\section{Data Structures}
\import{./Data Structures}{index.tex}
\newpage
\section{Maths}
\import{./Maths}{index.tex}
\newpage
\section{Hashing}
\import{./Hashing}{index.tex}
\newpage
\section{Geometry}
\import{./Geometry}{index.tex}
\newpage
\section{Miscellaneous Stuff}
\import{./Misc}{index.tex}
\newpage
\section{Picked Solutions}
\import{./Solutions}{index.tex}
\newpage
\section{References}
\bibliographystyle{plain}
\bibliography{refs}
\end{document}