-
Notifications
You must be signed in to change notification settings - Fork 0
/
codebook.tex
558 lines (397 loc) · 14.4 KB
/
codebook.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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
\documentclass[a4paper,10pt,twocolumn,oneside]{article}
\setlength{\columnsep}{10pt} %兩欄模式的間距
\setlength{\columnseprule}{0pt} %兩欄模式間格線粗細
\usepackage{amsthm} %定義,例題
\usepackage{amssymb}
%\usepackage[margin=2cm]{geometry}
\usepackage{fontspec} %設定字體
\usepackage{color}
\usepackage[x11names]{xcolor}
\usepackage{listings} %顯示code用的
%\usepackage[Glenn]{fncychap} %排版,頁面模板
\usepackage{fancyhdr} %設定頁首頁尾
\usepackage{graphicx} %Graphic
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage[CheckSingle, CJKmath]{xeCJK}
% \usepackage{CJKulem}
%\usepackage[T1]{fontenc}
\titlespacing{\section}{0cm}{0cm}{0cm}
\titlespacing{\subsection}{0cm}{0cm}{0cm}
\usepackage{amsmath, courier, listings, fancyhdr, graphicx}
\topmargin=0pt
\headsep=5pt
\textheight=780pt
\footskip=0pt
\voffset=-40pt
\textwidth=550pt
\marginparsep=0pt
\marginparwidth=0pt
\marginparpush=0pt
\oddsidemargin=0pt
\evensidemargin=0pt
\hoffset=-50pt
%\renewcommand\listfigurename{圖目錄}
%\renewcommand\listtablename{表目錄}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setmainfont [ %主要字型
Path = .fonts/ttf/,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic
] {Consolas}
\setmonofont [
Path = .fonts/ttf/,
UprightFont = *-Regular
] {Monaco}
%\setCJKmainfont{BabelStone Han}
%\setCJKmainfont{Source Han Sans}
%\setCJKmainfont{Consolas} %中文字型
%\setmainfont{sourcecodepro}
\XeTeXlinebreaklocale "zh" %中文自動換行
\XeTeXlinebreakskip = 0pt plus 1pt %設定段落之間的距離
\setcounter{secnumdepth}{3} %目錄顯示第三層
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
\@empty\z@\@empty
\makeatother
\lstset{ % Code顯示
language=C++, % the language of the code
basicstyle=\footnotesize\ttfamily, % the size of the fonts that are used for the code
%numbers=left, % where to put the line-numbers
numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1, each line will be numbered
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=false, % adds a frame around the code
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)}, % if you want to add a comment within your code
morekeywords={*}, % if you want to add more keywords to the set
keywordstyle=\bfseries\color{Blue1},
commentstyle=\itshape\color{Red4},
stringstyle=\itshape\color{Green4},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{fancy}
\fancyfoot{}
%\fancyfoot[R]{\includegraphics[width=20pt]{ironwood.jpg}}
\fancyhead[L]{National Taiwan University CRyptoGRapheR}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\contentsname}{Contents}
\scriptsize
\tableofcontents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \newpage
\section{Basic}
\subsection{.vimrc}
\lstinputlisting{basic/vimrc}
\subsection{hash.sh}
\lstinputlisting{basic/hash.sh}
%\subsection{Increase Stack Size}
%\lstinputlisting{basic/IncStack.cpp}
%\subsection{Increase Stack Size}
%\lstinputlisting{basic/IncStack_windows.cpp}
%\subsection{Misc}
%\lstinputlisting{basic/misc.cpp}
\subsection{Custom Hash}
\lstinputlisting{basic/custom_hash.cpp}
\subsection{Fast Division/Modular}
\lstinputlisting{basic/fastDiv.cpp}
\subsection{python-related}
\lstinputlisting{basic/python_trick.py}
\section{flow}
\subsection{ISAP}
\lstinputlisting{flow/isap.cpp}
%\subsection{MinCostFlow}
%\lstinputlisting{flow/MinCostFlow.cpp}
\subsection{MinCostFlow}
\lstinputlisting{flow/zkwflow.cpp}
\subsection{Dinic}
\lstinputlisting{flow/dinic_BCW.cpp}
%\subsection{Hungarian}
%\lstinputlisting{flow/Hungarian.cpp}
%\subsection{Hungarian Unbalanced}
%\lstinputlisting{flow/HungarianUnbalanced.cpp}
%\subsection{Kuhn Munkres}
%\lstinputlisting{flow/Kuhn_Munkres.cpp}
\subsection{Kuhn Munkres}
\lstinputlisting{flow/KM2.cpp}
%\subsection{Directed MST}
%\lstinputlisting{flow/DMST.cpp}
\subsection{SW min-cut}
\lstinputlisting{flow/SW-mincut.cpp}
\subsection{Max Cost Circulation}
\lstinputlisting{flow/MaxCostCirculation.cpp}
%\subsection{Gusfield}
%\lstinputlisting{flow/gusfield.cpp}
\subsection{Gomory-Hu Tree}
\lstinputlisting{flow/Gomory_Hu.cpp}
\subsection{Max flow with lower/upper bound}
\lstinputlisting{flow/BoundedMaxflow.cpp}
%\subsection{Relabel to Front}
%\lstinputlisting{flow/relabelToFront.cpp}
\subsection{HLPPA}
\lstinputlisting{flow/HLPPA2.cpp}
\subsection{Flow Method}
\lstinputlisting{flow/FlowMethod.txt}
\section{Math}
\subsection{FFT}
\lstinputlisting{math/FFT.cpp}
\subsection{NTT}
\lstinputlisting{math/ntt1.cpp}
\subsection{Fast Walsh Transform}
\lstinputlisting{math/FWT.cpp}
\subsection{FFT Mod}
\lstinputlisting{math/fftmod.cpp}
\subsection{Poly operator}
\lstinputlisting{math/polyop.cpp}
\subsection{Poly Interpolation}
\lstinputlisting{math/PolyInterpolate.cpp}
%\subsection{BigInt}
%\lstinputlisting{math/Bigint.cpp}
\subsection{Linear Recurrence}
\lstinputlisting{math/linearRecurrence.cpp}
\subsection{BerlekampMassey}
\lstinputlisting{math/BerlekampMassey.cpp}
\subsection{Miller Rabin}
\lstinputlisting{math/Miller_Rabin.cpp}
%\subsection{Simplex}
%\lstinputlisting{math/Simplex.cpp}
\subsection{Simplex}
\lstinputlisting{math/simplex2.cpp}
\subsection{Faulhaber}
\lstinputlisting{math/Faulhaber.cpp}
\subsection{Chinese Remainder}
\lstinputlisting{math/chineseRemainder.cpp}
\subsection{Pollard Rho}
\lstinputlisting{math/pollardRho.cpp}
%\subsection{Poly Generator}
%\lstinputlisting{math/PolyGen.cpp}
%\subsection{Matrix Pseudo Inverse}
%\lstinputlisting{math/Square_Matrix_pinv.cpp}
\subsection{ax+by=gcd}
\lstinputlisting{math/ax+by=gcd.cpp}
\subsection{Discrete sqrt}
\lstinputlisting{math/DiscreteSqrt.cpp}
\subsection{Discrete logarithm}
\lstinputlisting{math/discreteLog.cpp}
%\subsection{SchreierSims}
%\lstinputlisting{math/SchreierSims.cpp}
\subsection{Romberg}
\lstinputlisting{math/Romberg.cpp}
\subsection{Simpson}
\lstinputlisting{math/simpson.cpp}
%\subsection{Discrete K-th sqrt}
%\lstinputlisting{math/DiscreteKthsqrt.cpp}
\subsection{Prefix Inverse}
\lstinputlisting{math/prefixInv.cpp}
\subsection{Roots of Polynomial}
\lstinputlisting{math/rootsOfPolynomial.cpp}
%\subsection{Mod}
%\lstinputlisting{math/MOD.cpp}
%\subsection{Sum of Division/Modular}
%\lstinputlisting{math/divsumAndModsum.cpp}
\subsection{Sum of Division/Modular}
\lstinputlisting{math/divsum.cpp}
\subsection{Fraction Binary Search}
\lstinputlisting{math/fracBinarySearch.cpp}
\subsection{Closest Fraction}
\lstinputlisting{math/continuedFraction.cpp}
\subsection{Primes and $\mu$ function}
\lstinputlisting{math/primes.cpp}
\subsection{Prime Count}
\lstinputlisting{math/PrimeCount.cpp}
\subsection{Linear Basis}
\lstinputlisting{math/LinearBasis.cpp}
\subsection{Subset Convolution}
\lstinputlisting{math/subsetConv.cpp}
\subsection{Result}
\input{math/theorem.tex}
\section{Geometry}
% \subsection{Definition class}
% \lstinputlisting{geometry/definition.cpp}
\subsection{Intersection of 2 lines}
\lstinputlisting{geometry/Intersection_of_two_lines.cpp}
\subsection{halfPlaneIntersection}
\lstinputlisting{geometry/halfPlaneIntersection.cpp}
% \subsection{Convex Hull}
% \lstinputlisting{geometry/convex_hull.cpp}
\subsection{Intersection of 2 segments}
\lstinputlisting{geometry/Intersection_of_two_segments.cpp}
\subsection{Banana}
\lstinputlisting{geometry/banana.cpp}
% \subsection{Intersection of circle and segment}
% \lstinputlisting{geometry/Intersection_of_circle_and_segment.cpp}
\subsection{Intersection of circle and line}
\lstinputlisting{geometry/Intersection_of_circle_and_line.cpp}
%\subsection{Intersection of polygon and circle}
%\lstinputlisting{geometry/Intersection_of_polygon_and_circle.cpp}
\subsection{Intersection of polygon and circle}
\lstinputlisting{geometry/Intersection_of_polygon_and_circle_2.cpp}
\subsection{Intersection of 2 circles}
\lstinputlisting{geometry/Intersection_of_two_circles.cpp}
\subsection{Point In Polygon}
\lstinputlisting{geometry/PointInPolygon.cpp}
\subsection{Distance of line and point}
\lstinputlisting{geometry/PointToSegmentDistance.cpp}
\subsection{Distance of two segments}
\lstinputlisting{geometry/DistanceOfTwoSegments.cpp}
\subsection{Circle cover}
\lstinputlisting{geometry/CircleCover.cpp}
%\subsection{Intersection of segments set}
%\lstinputlisting{geometry/All_Pair_SSIntersection.cpp}
\subsection{Li Chao Segment Tree}
\lstinputlisting{dataStructure/LiChaoST.cpp}
\subsection{Convex Hull trick}
\lstinputlisting{geometry/ConvexHulltrick.cpp}
%\subsection{Rotating Caliper}
%\lstinputlisting{geometry/Rotating_Caliper.cpp}
\subsection{Convex Hull Diameter}
\lstinputlisting{geometry/HullDiameter.cpp}
\subsection{Rotating Sweep Line}
\lstinputlisting{geometry/rotatingSweepLine.cpp}
\subsection{Tangent line of two circles}
\lstinputlisting{geometry/Tangent_line_of_two_circles.cpp}
\subsection{Tangent line of point and circle}
\lstinputlisting{geometry/Tangent_line_of_point_and_circle.cpp}
\subsection{Min distance of two convex}
\lstinputlisting{geometry/MinDistOfTwoConvex.cpp}
%\subsection{KD Tree}
%\lstinputlisting{geometry/KDTree1.cpp}
\subsection{Poly Union}
\lstinputlisting{geometry/polyUnion.cpp}
\subsection{Lower Concave Hull}
\lstinputlisting{geometry/lowerConcaveHull3.cpp}
\subsection{Delaunay Triangulation}
\lstinputlisting{geometry/DelaunayTriangulation.cpp}
\subsection{Min Enclosing Circle}
\lstinputlisting{geometry/mec.cpp}
\subsection{Min Enclosing Ball}
\lstinputlisting{geometry/minEnclosingBall.cpp}
%\subsection{Minkowski sum}
%\lstinputlisting{geometry/Minkowski_Sum.cpp}
\subsection{Minkowski sum}
\lstinputlisting{geometry/minkowski-convex-hull.cpp}
% \subsection{Min Enclosing Circle}
% \lstinputlisting{geometry/minEnclosingCircle.cpp}
%\subsection{Min/Max Enclosing Rectangle}
%\lstinputlisting{geometry/minMaxEnclosingRectangle.cpp}
\subsection{Min and Max Enclosing Rectangle}
\lstinputlisting{geometry/minMaxEnclosingRectangle2.cpp}
\subsection{Min dist on Cuboid}
\lstinputlisting{geometry/minDistonCuboid.cpp}
\subsection{Heart of Triangle}
\lstinputlisting{geometry/triangle.cpp}
\section{Graph}
%\subsection{HeavyLightDecomp}
%\lstinputlisting{graph/HeavyLightDecomp.cpp}
\subsection{DominatorTree}
\lstinputlisting{graph/DominatorTree.cpp}
\subsection{Directed MST(ElogE)}
%\lstinputlisting{graph/DMST_ElogE.cpp}
\lstinputlisting{graph/DMST_ElogE_recon.cpp}
%\subsection{MaxClique}
% \lstinputlisting{graph/MaxClique.cpp}
%\lstinputlisting{graph/MaximumClique.cpp}
\subsection{MaximalClique}
\lstinputlisting{graph/MaximalClique.cpp}
\subsection{MaxCliqueDyn}
\lstinputlisting{graph/MaxCliqueDyn.cpp}
%\subsection{Number of Maximal Clique}
%\lstinputlisting{graph/NumberofMaximalClique.cpp}
\subsection{Strongly Connected Component}
\lstinputlisting{graph/tarjanSCC.cpp}
\subsection{Dynamic MST}
\lstinputlisting{graph/DynamicMST.cpp}
\subsection{Maximum General graph Matching}
\lstinputlisting{graph/generalMatching.cpp}
\subsection{Minimum General Weighted Matching}
\lstinputlisting{graph/Minimum_General_Weighted_Matching.cpp}
\subsection{Maximum General Weighted Matching}
\lstinputlisting{graph/BorrowedGeneralWeightedMatching.cpp}
\subsection{Edge Coloring}
\lstinputlisting{graph/EdgeColoring.cpp}
\subsection{Minimum Steiner Tree}
\lstinputlisting{graph/MinimumSteinerTree.cpp}
\subsection{BCC based on vertex}
\lstinputlisting{graph/bcc_vertex.cpp}
\subsection{Min Mean Cycle}
\lstinputlisting{graph/MinMeanCycle.cpp}
\subsection{Directed Graph Min Cost Cycle}
\lstinputlisting{graph/DirectedGraphMinCycle.cpp}
\subsection{K-th Shortest Path}
\lstinputlisting{graph/KSP.cpp}
\subsection{Chordal Graph}
\lstinputlisting{graph/chordal.cpp}
\subsection{Matroid Intersection}
\lstinputlisting{graph/matroidIntersection.cpp}
\subsection{Tree Hash}
\lstinputlisting{graph/TreeHash.cpp}
\subsection{Graph Hash}
\input{graph/graphHash.tex}
\subsection{Graph Method}
\lstinputlisting{graph/GraphMethod.txt}
\section{String}
\subsection{PalTree}
\lstinputlisting{string/PalTree1.cpp}
%\subsection{SuffixArray}
%\lstinputlisting{string/Suffix_Array.cpp}
\subsection{SAIS}
\lstinputlisting{string/SAIS.cpp}
\subsection{SuffixAutomata}
\lstinputlisting{string/SAM.cpp}
%\subsection{Aho-Corasick}
%\lstinputlisting{string/Aho-Corasick.cpp}
\subsection{Z Value}
\lstinputlisting{string/zvalue.cpp}
\subsection{BWT}
\lstinputlisting{string/BWT.cpp}
\subsection{ZValue Palindrome}
\lstinputlisting{string/zvalue_palindrome.cpp}
\subsection{Smallest Rotation}
%\lstinputlisting{string/smallest_rotation.cpp}
\lstinputlisting{string/minRotation.cpp}
%\subsection{Baker Bird}
%\lstinputlisting{string/bakerBird.cpp}
\subsection{Cyclic LCS}
\lstinputlisting{string/cyclicLCS.cpp}
\section{Data Structure}
%\subsection{Treap}
%\lstinputlisting{dataStructure/treap.cpp}
\subsection{Link-Cut Tree}
\lstinputlisting{dataStructure/link_cut_tree.cpp}
%\subsection{Disjoint Set}
%\lstinputlisting{dataStructure/DisjointSet.cpp}
%\subsection{Pairing Heap}
%\lstinputlisting{dataStructure/pairing_heap.cpp}
%\subsection{Leftist Heap}
%\lstinputlisting{dataStructure/Leftist_Heap.cpp}
%\subsection{Black Magic}
%\lstinputlisting{dataStructure/extc_bt.cpp}
\section{Others}
\subsection{Find max tangent(x,y is increasing)}
\lstinputlisting{others/maxtan.cpp}
\subsection{Exact Cover Set}
\lstinputlisting{others/exactCoverSet.cpp}
%\subsection{Exact Cover Set}
%\lstinputlisting{others/DLX.cpp}
\subsection{Binary Next Permutation}
\lstinputlisting{others/binary_next_permutation.cpp}
\subsection{Hilbert Curve}
\lstinputlisting{others/HilbertCurve.cpp}
\subsection{DeBrujin Sequence}
\lstinputlisting{others/DeBrujin.cpp}
%\subsection{\# of Intersection of segments}
%\lstinputlisting{others/painter.cpp}
\end{document}