Download - NWERC 2014 Presentation of solutions
![Page 1: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/1.jpg)
NWERC 2014Presentation of solutions
The Jury
2014-11-30
NWERC 2014 solutions
![Page 2: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/2.jpg)
NWERC 2014 Jury
Per Austrin (KTH Royal Institute of Technology)
Thomas Beuman (Leiden University)
Jeroen Bransen (Utrecht University)
Tommy Färnqvist (LiU)
Jan Kuipers (AppTornado)
Luká² Polá£ek (KTH and Spotify)
Alexander Rass (FAU)
Fredrik Svensson (Autoliv Electronics)
Tobias Werth (FAU)
NWERC 2014 solutions
![Page 3: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/3.jpg)
J � Judging
Problem
Given two lists of strings, match them up so that as many aspossible are identical.
Solution
1 Count how many times each word appears in each list.
2 Number of matches for each word is minimum of#occurrences in �rst list and #occurrences in second list.
3 Sum over all words.
Statistics: 135 submissions, 92 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 4: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/4.jpg)
J � Judging
Problem
Given two lists of strings, match them up so that as many aspossible are identical.
Solution
1 Count how many times each word appears in each list.
2 Number of matches for each word is minimum of#occurrences in �rst list and #occurrences in second list.
3 Sum over all words.
Statistics: 135 submissions, 92 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 5: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/5.jpg)
J � Judging
Problem
Given two lists of strings, match them up so that as many aspossible are identical.
Solution
1 Count how many times each word appears in each list.
2 Number of matches for each word is minimum of#occurrences in �rst list and #occurrences in second list.
3 Sum over all words.
Statistics: 135 submissions, 92 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 6: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/6.jpg)
J � Judging
Problem
Given two lists of strings, match them up so that as many aspossible are identical.
Solution
1 Count how many times each word appears in each list.
2 Number of matches for each word is minimum of#occurrences in �rst list and #occurrences in second list.
3 Sum over all words.
Statistics: 135 submissions, 92 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 7: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/7.jpg)
J � Judging
Problem
Given two lists of strings, match them up so that as many aspossible are identical.
Solution
1 Count how many times each word appears in each list.
2 Number of matches for each word is minimum of#occurrences in �rst list and #occurrences in second list.
3 Sum over all words.
Statistics: 135 submissions, 92 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 8: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/8.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 9: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/9.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 10: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/10.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 11: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/11.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 12: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/12.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 13: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/13.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 14: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/14.jpg)
E � Euclidean TSP
Problem
Find minimum of the following function:
f (c) =n · (log2 n)c
√2
109p+ (1+
1
c) · s
v
Solution
This is a convex function, so use ternary search:
Calculate value at some small and large c (e.g. 1 and 100)
Calculate value at 1/3 and 2/3 of this interval (i.e. 34 and 67)
If f(34) < f(68), the minimum is in [1,68], otherwise in [34,100].
Iterate this a few dozen times to narrow down the interval.
Statistics: 91 submissions, 61 accepted
Problem Author: Luká² Polá£ek NWERC 2014 solutions
![Page 15: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/15.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 16: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/16.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 17: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/17.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}
Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 18: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/18.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 19: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/19.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 20: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/20.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 21: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/21.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 22: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/22.jpg)
C � Cent Savings
Problem
Split list of n item prices into d + 1 groups, minimize sum ofrounded costs.
Solution
Let C (i , j) be minimum cost of �rst i items using j groups.
C (i , j) = mini ′<i
{C (i ′, j − 1) + Round(xi ′+1 + . . .+ xi )
}Compute with dynamic programming.
As written O(n3d) � too slow
Don't recompute sums O(n2d) � fast enough
Be more clever O(nd) � even faster
Statistics: 216 submissions, 62 accepted
Problem Author: Tobias Werth NWERC 2014 solutions
![Page 23: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/23.jpg)
H � Hyacinth
Problem
Given a tree, assign a number (the frequency) to each edge, suchthat every node is adjacent to at most 2 di�erent numbers (itsNIC's frequencies), and as many numbers as possible are used.
Solution
Greedy: start somewhere, assign a new number to an edge ifpossible, otherwise reuse one, and then recurse.
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 24: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/24.jpg)
H � Hyacinth
Problem
Given a tree, assign a number (the frequency) to each edge, suchthat every node is adjacent to at most 2 di�erent numbers (itsNIC's frequencies), and as many numbers as possible are used.
Solution
Greedy: start somewhere, assign a new number to an edge ifpossible, otherwise reuse one, and then recurse.
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 25: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/25.jpg)
H � Hyacinth (sample 2)
1
2
5 6
3
7
11 12 13 14
4
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 26: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/26.jpg)
H � Hyacinth (sample 2)
1
2
1
5 6
3
7
11 12 13 14
4
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 27: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/27.jpg)
H � Hyacinth (sample 2)
1
2
1
5 6
3
2
7
11 12 13 14
4
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 28: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/28.jpg)
H � Hyacinth (sample 2)
1
2
1
5 6
3
2
7
11 12 13 14
4
1
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 29: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/29.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
3
2
7
11 12 13 14
4
1
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 30: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/30.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
11 12 13 14
4
1
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 31: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/31.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11 12 13 14
4
1
8 9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 32: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/32.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11 12 13 14
4
1
8
5
9 10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 33: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/33.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11 12 13 14
4
1
8
5
9
1
10
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 34: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/34.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11 12 13 14
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 35: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/35.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11
6
12 13 14
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 36: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/36.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11
6
12
4
13 14
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 37: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/37.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11
6
12
4
13
4
14
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 38: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/38.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11
6
12
4
13
4
14
4
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 39: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/39.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11
6
12
4
13
4
14
4
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 40: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/40.jpg)
H � Hyacinth (sample 2)
1
2
1
5
3
6
1
3
2
7
4
11
6
12
4
13
4
14
4
4
1
8
5
9
1
10
1
Note: the number of di�erent used channels equals the number ofinternal nodes + 1.
Statistics: 213 submissions, 70 accepted
Problem Author: Tommy Färnqvist NWERC 2014 solutions
![Page 41: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/41.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 42: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/42.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 43: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/43.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 44: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/44.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 45: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/45.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 46: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/46.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 47: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/47.jpg)
F � Finding Lines
Problem
Given n points in R2, is there a straight line passing through atleast a p fraction of them?
Solution
If line exists it is uniquely determined by any two of its points.
Probability that a random point lies on the line is ≥ p.
Repeat 250 times:1 Pick two distinct points uniformly at random2 Check if line de�ned by the points has enough points.
Pr[false negative] ≈ (1− p2)250 ≤ (1− 1/25)250 < 5 · 10−5(cheated slightly � it's a bit worse)
Many other ways e.g. divide and conquer
Statistics: 222 submissions, 23 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 48: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/48.jpg)
D � Digi Comp II
Problem
Given a directed acyclic graph, where the nodes are switches thatsend balls to the left and right in turns, what is its end state.
Solution
Don't simulate 1018 balls one by one!
Observation: if N balls arrive at a node, dN/2e go to one side,and bN/2c to the other side, and its state is �ipped i� N isodd.
Process nodes one by one
Do it in topological sort order.
Statistics: 327 submissions, 43 accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 49: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/49.jpg)
D � Digi Comp II
Problem
Given a directed acyclic graph, where the nodes are switches thatsend balls to the left and right in turns, what is its end state.
Solution
Don't simulate 1018 balls one by one!
Observation: if N balls arrive at a node, dN/2e go to one side,and bN/2c to the other side, and its state is �ipped i� N isodd.
Process nodes one by one
Do it in topological sort order.
Statistics: 327 submissions, 43 accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 50: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/50.jpg)
D � Digi Comp II
Problem
Given a directed acyclic graph, where the nodes are switches thatsend balls to the left and right in turns, what is its end state.
Solution
Don't simulate 1018 balls one by one!
Observation: if N balls arrive at a node, dN/2e go to one side,and bN/2c to the other side, and its state is �ipped i� N isodd.
Process nodes one by one
Do it in topological sort order.
Statistics: 327 submissions, 43 accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 51: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/51.jpg)
D � Digi Comp II
Problem
Given a directed acyclic graph, where the nodes are switches thatsend balls to the left and right in turns, what is its end state.
Solution
Don't simulate 1018 balls one by one!
Observation: if N balls arrive at a node, dN/2e go to one side,and bN/2c to the other side, and its state is �ipped i� N isodd.
Process nodes one by one
Do it in topological sort order.
Statistics: 327 submissions, 43 accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 52: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/52.jpg)
D � Digi Comp II
Problem
Given a directed acyclic graph, where the nodes are switches thatsend balls to the left and right in turns, what is its end state.
Solution
Don't simulate 1018 balls one by one!
Observation: if N balls arrive at a node, dN/2e go to one side,and bN/2c to the other side, and its state is �ipped i� N isodd.
Process nodes one by one
Do it in topological sort order.
Statistics: 327 submissions, 43 accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 53: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/53.jpg)
D � Digi Comp II
Problem
Given a directed acyclic graph, where the nodes are switches thatsend balls to the left and right in turns, what is its end state.
Solution
Don't simulate 1018 balls one by one!
Observation: if N balls arrive at a node, dN/2e go to one side,and bN/2c to the other side, and its state is �ipped i� N isodd.
Process nodes one by one
Do it in topological sort order.
Statistics: 327 submissions, 43 accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 54: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/54.jpg)
K � Knapsack Collection
Problem
How long does it take to pick up all n knapsacks at the luggagecarousel?
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 55: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/55.jpg)
K � Knapsack Collection
Problem
How long does it take to pick up all n knapsacks at the luggagecarousel?
Solution
Given starting position, can simulate the process in O(n log n)
Keep positions of knapsacks in a set for fast lookup of when
the next knapsack will arrive.
The interesting starting positions are the ≤ n slots where thereare knapsacks.
Time from others grow arithmetically
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 56: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/56.jpg)
K � Knapsack Collection
Problem
How long does it take to pick up all n knapsacks at the luggagecarousel?
Solution
Given starting position, can simulate the process in O(n log n)
Keep positions of knapsacks in a set for fast lookup of when
the next knapsack will arrive.
The interesting starting positions are the ≤ n slots where thereare knapsacks.
Time from others grow arithmetically
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 57: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/57.jpg)
K � Knapsack Collection
Problem
How long does it take to pick up all n knapsacks at the luggagecarousel?
Solution
Given starting position, can simulate the process in O(n log n)
Keep positions of knapsacks in a set for fast lookup of when
the next knapsack will arrive.
The interesting starting positions are the ≤ n slots where thereare knapsacks.
Time from others grow arithmetically
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 58: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/58.jpg)
K � Knapsack Collection
Problem
How long does it take to pick up all n knapsacks at the luggagecarousel?
Solution
t1
t1 + 1
t1 + 2 t1 + 3t2
t3
t2+1
t2+2
t3+1t3+2t3+4
Statistics: 68 submissions, 22 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 59: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/59.jpg)
K � Knapsack Collection
Problem
How long does it take to pick up all n knapsacks at the luggagecarousel?
Solution
t1
t1 + 1
t1 + 2 t1 + 3t2
t3
t2+1
t2+2
t3+1t3+2t3+4
Statistics: 68 submissions, 22 accepted
Problem Author: Alexander Rass NWERC 2014 solutions
![Page 60: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/60.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 61: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/61.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).
Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 62: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/62.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 63: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/63.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).
Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 64: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/64.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 65: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/65.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 66: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/66.jpg)
I � Indoorienteering
Problem
Given a weighted graph, determine whether there exists a cyclewith length L that visits every vertex once.
Solution
First of all, O(N!) is too slow (14! = 87 · 109).Take 0 as starting point and loop over middle point: O(N).
Partition remaining points into 1st and 2nd half: O(2N).Calculate possible lengths of half-cycles: O((N/2)!).
For every half-cycle length K , check whether L− K exists inO(1) with hashset or so.
Statistics: 79 submissions, 7 accepted
Problem Author: Jeroen Bransen NWERC 2014 solutions
![Page 67: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/67.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 68: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/68.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
The �ideal� position is x∗ = median(x1, . . . , xn) andy∗ = median(y1, . . . , yn)
But might be more than distance d away from some point...
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 69: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/69.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
The �ideal� position is x∗ = median(x1, . . . , xn) andy∗ = median(y1, . . . , yn)
But might be more than distance d away from some point...
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 70: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/70.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
Feasible region is intersection of diamonds, forms a �skeweddiamond�
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 71: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/71.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
Key observation: there is an optimal point which either:1 Is a corner of the feasible region, or2 Shares x-value with an input point, or3 Shares y -value with an input point.
Given a candidate value for x∗, we get a range of allowed y
values ylo ...yhi . Best choice is median y (if in range) or ylo oryhi .
(Similarly for best x value given candindate value of y∗)
Statistics: 20 submissions, ? accepted
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 72: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/72.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
Key observation: there is an optimal point which either:1 Is a corner of the feasible region, or2 Shares x-value with an input point, or3 Shares y -value with an input point.
Given a candidate value for x∗, we get a range of allowed y
values ylo ...yhi . Best choice is median y (if in range) or ylo oryhi .
(Similarly for best x value given candindate value of y∗)
Statistics: 20 submissions, ? accepted
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 73: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/73.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
Key observation: there is an optimal point which either:1 Is a corner of the feasible region, or2 Shares x-value with an input point, or3 Shares y -value with an input point.
Given a candidate value for x∗, we get a range of allowed y
values ylo ...yhi . Best choice is median y (if in range) or ylo oryhi .
(Similarly for best x value given candindate value of y∗)
Statistics: 20 submissions, ? accepted
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 74: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/74.jpg)
G � Gathering
Problem
Given points (x1, y1), . . . , (xn, yn), �nd point (x∗, y∗) minimizingsum of Manhattan distances to all points, while being withinManhattan distance d of all points.
Solution
Key observation: there is an optimal point which either:1 Is a corner of the feasible region, or2 Shares x-value with an input point, or3 Shares y -value with an input point.
Given a candidate value for x∗, we get a range of allowed y
values ylo ...yhi . Best choice is median y (if in range) or ylo oryhi .
(Similarly for best x value given candindate value of y∗)
Statistics: 20 submissions, ? acceptedProblem Author: Thomas Beuman NWERC 2014 solutions
![Page 75: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/75.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Possible solutions use 0 or 2 stations:
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 76: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/76.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Possible solutions use 0 or 2 stations:
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 77: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/77.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Loop over station 1 and 2 (existing, or NSEW boundary).
Calculate distance.
To determine correct location on the boundary use ternarysearch, since distance as function of position is a convexfunction.
For 2 boundary stations, use nested ternary searches.
Doing it with math becomes a terrible mess.
Statistics: 7 submissions, ? accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 78: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/78.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Loop over station 1 and 2 (existing, or NSEW boundary).
Calculate distance.
To determine correct location on the boundary use ternarysearch, since distance as function of position is a convexfunction.
For 2 boundary stations, use nested ternary searches.
Doing it with math becomes a terrible mess.
Statistics: 7 submissions, ? accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 79: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/79.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Loop over station 1 and 2 (existing, or NSEW boundary).
Calculate distance.
To determine correct location on the boundary use ternarysearch, since distance as function of position is a convexfunction.
For 2 boundary stations, use nested ternary searches.
Doing it with math becomes a terrible mess.
Statistics: 7 submissions, ? accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 80: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/80.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Loop over station 1 and 2 (existing, or NSEW boundary).
Calculate distance.
To determine correct location on the boundary use ternarysearch, since distance as function of position is a convexfunction.
For 2 boundary stations, use nested ternary searches.
Doing it with math becomes a terrible mess.
Statistics: 7 submissions, ? accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 81: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/81.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Loop over station 1 and 2 (existing, or NSEW boundary).
Calculate distance.
To determine correct location on the boundary use ternarysearch, since distance as function of position is a convexfunction.
For 2 boundary stations, use nested ternary searches.
Doing it with math becomes a terrible mess.
Statistics: 7 submissions, ? accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 82: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/82.jpg)
B � Biking Duck
Problem
Find shortest path, possibly via some of the given bike stations orthe (in�nitely many possible) stations the boundary.
Solution
Loop over station 1 and 2 (existing, or NSEW boundary).
Calculate distance.
To determine correct location on the boundary use ternarysearch, since distance as function of position is a convexfunction.
For 2 boundary stations, use nested ternary searches.
Doing it with math becomes a terrible mess.
Statistics: 7 submissions, ? accepted
Problem Author: Jan Kuipers NWERC 2014 solutions
![Page 83: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/83.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 84: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/84.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Solution
Without the outer boundary: convex hull
A somewhat unusual convex hull algorithm.1 Find a point where we make a right-turn, shortcut if possible2 Repeat until done
With outer boundary: when shortcutting, can't go straight,need to wrap around the outer boundary
Convex hull computation
Can also use Dijkstra, need to be careful to make a full lap aroundthe inner polygon.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 85: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/85.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Solution
Without the outer boundary: convex hull
A somewhat unusual convex hull algorithm.1 Find a point where we make a right-turn, shortcut if possible2 Repeat until done
With outer boundary: when shortcutting, can't go straight,need to wrap around the outer boundary
Convex hull computation
Can also use Dijkstra, need to be careful to make a full lap aroundthe inner polygon.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 86: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/86.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Solution
Without the outer boundary: convex hull
A somewhat unusual convex hull algorithm.1 Find a point where we make a right-turn, shortcut if possible2 Repeat until done
With outer boundary: when shortcutting, can't go straight,need to wrap around the outer boundary
Convex hull computation
Can also use Dijkstra, need to be careful to make a full lap aroundthe inner polygon.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 87: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/87.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Solution
Without the outer boundary: convex hull
A somewhat unusual convex hull algorithm.1 Find a point where we make a right-turn, shortcut if possible2 Repeat until done
With outer boundary: when shortcutting, can't go straight,need to wrap around the outer boundary
Convex hull computation
Can also use Dijkstra, need to be careful to make a full lap aroundthe inner polygon.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 88: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/88.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 89: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/89.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 90: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/90.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 91: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/91.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 92: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/92.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 93: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/93.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 94: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/94.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 95: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/95.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 96: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/96.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 97: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/97.jpg)
A � Around the Track
Problem
Find shortest tour around a track de�ned by two polygons.
Statistics: 12 submissions, ? accepted
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 98: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/98.jpg)
Problem Author: Thomas Beuman NWERC 2014 solutions
![Page 99: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/99.jpg)
Random numbers produced by the jury
1087 number of posts made in the jury's forum.
671 commits made to the problem set repository.
380 number of lines of code used in total by the shortest judgesolutions to solve the entire problem set.
16.7 average number of jury solutions per problem (includingincorrect ones)
1 number of beers Jan lost to Per over bets on the problems
1 number of beers Per lost to Jan over bets on the contestresults
NWERC 2014 solutions
![Page 100: NWERC 2014 Presentation of solutions](https://reader036.vdocuments.us/reader036/viewer/2022090906/613ca0a2f046235e845cda8e/html5/thumbnails/100.jpg)
Random numbers produced by the jury
1087 number of posts made in the jury's forum.
671 commits made to the problem set repository.
380 number of lines of code used in total by the shortest judgesolutions to solve the entire problem set.
16.7 average number of jury solutions per problem (includingincorrect ones)
1 number of beers Jan lost to Per over bets on the problems
1 number of beers Per lost to Jan over bets on the contestresults
NWERC 2014 solutions