Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 466a79c

Browse files
committed
Added titlepage and intersection algorithm
1 parent 2f479a6 commit 466a79c

File tree

6 files changed

+70
-12
lines changed

6 files changed

+70
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
main_mod.tex
22
build/*
33
main.pdf
4+
*.pdf
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Intersection of line segments
2+
## \note Line segments are given by the coordinates of their end points.
3+
struct Point {
4+
5+
long long x, y;
6+
7+
};
8+
9+
struct Line {
10+
Point p, q;
11+
};
12+
13+
int sgn(long long x) {
14+
return x == 0 ? 0 : (x < 0 ? -1 : 1);
15+
}
16+
17+
long long det(long long x1, long long y1, long long x2, long long y2) {
18+
return x1 * y2 - x2 * y1;
19+
}
20+
21+
int orientation(Point p, Point q, Point r) {
22+
return sgn(det(p.x - r.x, p.y - r.y, q.x - r.x, q.y - r.y));
23+
}
24+
25+
bool intersect(Line l1, Line l2) {
26+
if (max(l1.p.x, l1.q.x) < min(l2.p.x, l2.q.x)) return false;
27+
if (max(l2.p.x, l2.q.x) < min(l1.p.x, l1.q.x)) return false;
28+
if (max(l1.p.y, l1.q.y) < min(l2.p.y, l2.q.y)) return false;
29+
if (max(l2.p.y, l2.q.y) < min(l1.p.y, l1.q.y)) return false;
30+
return orientation(l1.q, l2.p, l1.p) * orientation(l1.q, l2.q, l1.p) <= 0
31+
&& orientation(l2.q, l1.p, l2.p) * orientation(l2.q, l1.q, l2.p) <= 0;
32+
}

logo.eps

209 KB
Binary file not shown.

logo_rgb.eps

215 KB
Binary file not shown.

main.tex

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
\documentclass[a4paper, twocolumn]{article}
2-
\usepackage[landscape, a4paper, left=1cm, right=1cm, top=1cm, bottom=2cm]{geometry}
2+
\usepackage[landscape, a4paper, left=1cm, right=1cm, top=1cm, bottom=4cm]{geometry}
33
\usepackage[parfill]{parskip}
44
\usepackage{fancyhdr}
55
\usepackage{tikz}
@@ -15,7 +15,7 @@
1515

1616
% Team Name
1717
\newcommand{\teamname}{Crystal Math}
18-
18+
\newcommand{\teammembers}{Gabriëlle Zwaneveld, Sven Holtrop and Lucas Crijns}
1919
% Useful commands
2020
\renewcommand{\vec}{\overrightarrow}
2121
\newcommand{\pageend}{\vfill\newpage}
@@ -24,6 +24,10 @@
2424
\newcommand{\point}[4]{\draw[fill] (#1,#2) circle (1pt) node[#4] {#3}}
2525
\newcommand{\note}{\textbf{Note: }}
2626

27+
% Fix Header
28+
\setlength{\topmargin}{0cm}
29+
\setlength{\headsep}{0cm}
30+
\setlength{\columnsep}{1cm}
2731
% Syntax Highlighting
2832
\lstset{language=python}
2933
\input{highlighting.tex}
@@ -38,12 +42,18 @@
3842
\fill [SpecialBlue] (0cm, 0cm) rectangle (\paperwidth, 1.5cm);
3943
\end{tikzpicture}
4044
};
45+
\node[yshift=-2cm] at (current page.north west) {
46+
\begin{tikzpicture}[remember picture, overlay]
47+
\fill [SpecialBlue] (0cm, 0cm) rectangle (\paperwidth, 2cm);
48+
\node at (\paperwidth - 2.5cm, 0.7cm) {\includegraphics[height=3cm]{logo.eps}};
49+
\end{tikzpicture}
50+
};
4151
\end{tikzpicture}
4252
}
4353
\fancyhead{\mkfoot}
4454
\fancyfoot{}
4555
\fancyfoot[L]{\color{white} \large \textbf{\teamname} Cheatsheet}
46-
\fancyfoot[R]{\color{white} Gabriëlle Zwaneveld, Sven Holtrop en Lucas Crijns \hspace{1.3em} \large \textbf\thepage}
56+
\fancyfoot[R]{\color{white} \teammembers \hspace{1.3em} \large \textbf\thepage}
4757
\renewcommand{\headrulewidth}{0cm}
4858
\renewcommand{\headrulewidth}{0cm}
4959

@@ -53,10 +63,23 @@
5363

5464
\begin{document}
5565

66+
% Title page
67+
\begin{titlepage}
68+
\centering
69+
~\\
70+
\vspace{20px}
71+
\resizebox{700px}{!}{\Huge Team Contest Reference}
72+
\\ \vspace{40px}
73+
\resizebox{400px}{!}{\Huge \textcolor{SpecialBlue}{\textbf{\teamname}}}
74+
\\ \vspace{20px}
75+
\resizebox{500px}{!}{\LARGE \teammembers}
76+
\includegraphics[width=300px]{logo_rgb.eps}
77+
\end{titlepage}
78+
5679
\section{Modules}
5780
\subsection{Python}
5881
\begin{itemize}
59-
\item Priority queue \arrow \ms{queue.PriorityQueue}
82+
\item Priority queue \arrow \ms{heapq}
6083
\item Python base switching \arrow \ms{int(x, base=b)}
6184
\item Deque \arrow \ms{collections.deque}
6285
\end{itemize}
@@ -113,7 +136,6 @@ \subsection*{More Formulas}
113136
16796\}
114137
\end{align*}
115138
\vspace{-1em}
116-
\newpage
117139
\subsection*{Fibonacci Numbers}\vspace*{-1em}
118140
\begin{align*}
119141
1,1,2,3,5,8,13,21,34,55,89, 144, 233, 377, 610, 987, 1597, 2584
@@ -242,6 +264,9 @@ \subsection{Lagrange polynomials}
242264
l_j(x) &= \prod_{0 \leq m \leq k, m \neq j} \frac{x-x_m}{x_j-x_m} \\
243265
\end{align*}
244266

267+
\subsection*{Graphs}
268+
For a connected planar graph, the number of vertices $V$, edges $E$ and planar faces $F$ obeys: $V-E+f=2$ (this includes the outer face).
269+
245270
\section{Algorithms}
246271

247272
%PLACEHOLDER%

substitute.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/bin/env python
22
import sys
33
from os import listdir
4-
from os.path import isfile, join
4+
from os.path import isfile, join, getsize
55

66
# Get files in directory
77
algorithm_dir = sys.argv[1]
8-
filelist = [f for f in listdir(algorithm_dir) if isfile(join(algorithm_dir, f))]
9-
filelist.sort()
8+
filelist = [join(algorithm_dir, f) for f in listdir(algorithm_dir) if isfile(join(algorithm_dir, f))]
9+
filelist.sort(key=lambda x: getsize(x))
1010

1111
def get_lang(f):
12-
if f[-3:] == ".py": return "python"
13-
elif f[-5:] == ".java": return "java"
14-
elif f[-4:] == ".cpp": return "cpp"
12+
if f[-3:] == ".py": return "Python"
13+
elif f[-5:] == ".java": return "Java"
14+
elif f[-4:] == ".cpp": return "C++"
1515
else: return "java"
1616

1717
inclusion = ""
1818
for f in filelist:
19-
with open(join(algorithm_dir, f)) as file:
19+
with open(f) as file:
2020
data = file.read()
2121
code = "\n".join([i for i in data.partition('\n')[-1].splitlines() if not i.startswith("##")])
2222
title = data.splitlines()[0][2:].strip()

0 commit comments

Comments
 (0)