Helvetic Coding Contest 2016 online mirror (teams, unrated)


A1. Collective Mindsets (easy)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
1
Input
4
Output
2
----------------------------------------------------------------------------------------------------
A2. Collective Mindsets (medium)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
0
Input
3
Output
1
Input
99
Output
49
----------------------------------------------------------------------------------------------------
A3. Collective Mindsets (hard)
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 1
1
2 2
1
2 1
2
2 2
2
Output
1
2
2
1
Input
2
5 2
2 2 2 2
6 4
3 2 6 1 2
Output
5
2
----------------------------------------------------------------------------------------------------
B1. Recover Polygon (easy)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
000000
000000
012100
024200
012100
000000
Output
Yes
----------------------------------------------------------------------------------------------------
B2. Recover Polygon (medium)
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
00000000
00000110
00012210
01234200
02444200
01223200
00001100
00000000
5
00000
01210
02420
01210
00000
7
0000000
0122100
0134200
0013200
0002200
0001100
0000000
0
Output
4
2 3
2 4
6 6
5 2
4
2 2
2 3
3 3
3 2
3
2 5
4 5
4 2
----------------------------------------------------------------------------------------------------
B3. Recover Polygon (hard)
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 19
2 3 2 4 2 5 3 3 3 5 4 3 4 5 4 6 5 2 5 3 5 6 6 2 6 3 6 4 6 5 6 6 6 7 7 6 7 7
5 8
2 2 2 3 2 4 3 2 3 4 4 2 4 3 4 4
0 0
Output
4
2 3
2 4
6 6
5 2
4
2 2
2 3
3 3
3 2
----------------------------------------------------------------------------------------------------
C1. Brain Network (easy)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 2
2 3
3 1
4 1
Output
no
Input
6 5
1 2
2 3
3 4
4 5
3 6
Output
yes
----------------------------------------------------------------------------------------------------
C2. Brain Network (medium)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 2
1 3
1 4
Output
2
Input
5 4
1 2
2 3
3 4
3 5
Output
3
----------------------------------------------------------------------------------------------------
C3. Brain Network (hard)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1
2
2
1
5
Output
1 2 2 3 4 
----------------------------------------------------------------------------------------------------
D1. The Wall (easy)
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 7
.......
.......
.BB.B..
Output
2
Input
4 5
..B..
..B..
B.B.B
BBB.B
Output
2
Input
4 6
..B...
B.B.BB
BBB.BB
BBBBBB
Output
1
Input
1 1
B
Output
1
Input
10 7
.......
.......
.......
.......
.......
.......
.......
.......
...B...
B.BB.B.
Output
3
Input
8 8
........
........
........
........
.B......
.B.....B
.B.....B
.BB...BB
Output
2
----------------------------------------------------------------------------------------------------
D2. The Wall (medium)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1
Output
5
Input
2 2
Output
5
Input
3 2
Output
9
Input
11 5
Output
4367
Input
37 63
Output
230574
----------------------------------------------------------------------------------------------------
D3. The Wall (hard)
time limit per test: 15 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1
Output
2
Input
1 2 2
Output
3
Input
1 2 3
Output
4
Input
3 2 2
Output
19
Input
5 4 9
Output
40951
Input
40 37 65
Output
933869
----------------------------------------------------------------------------------------------------
E1. Photographs (I)
time limit per test: 15 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

No test samples are available for this problem
----------------------------------------------------------------------------------------------------
E2. Photographs (II)
time limit per test: 15 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

No test samples are available for this problem
----------------------------------------------------------------------------------------------------
F1. Tree of Life (easy)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
1 3
1 4
Output
3
Input
5
1 2
2 3
3 4
3 5
Output
4
----------------------------------------------------------------------------------------------------
F2. Tree of Life (medium)
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
5 5
2
4 1
2 1
1
3 1
3
4 1
4 3
2 1
3
3 1
3 2
4 1
3
2 1
3 2
4 2
Output
YES
2 5
4 2
3 2
5 1
----------------------------------------------------------------------------------------------------
F3. Tree of Life (hard)
time limit per test: 8 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
9 2
6
4 3
5 4
6 1
8 6
8 2
7 1
5
8 6
8 7
8 1
7 3
5 1
Output
YES
2 1
3 1
5 4
6 5
7 6
8 5
9 8
1 4
----------------------------------------------------------------------------------------------------
