Judge's Notes for Connect
I used the output to System.err to draw the final boards in the solutions, since some are complicated.
4 5
0 2 2 4 4 2 3 2 2 3
4 5
0 2 2 4 4 2 3 2 2 1
7 11
0 3 6 5 3 2 5 7 7 2 4 4
5 3 5 2 4 5 4 0 2 4
Pictures for the three datasets above are in Problem statement.
5 9
3 1 3 3
0 2 2 5 2 3 2 1 4
3 4 0 5 1
yes
4 5
0 1 2 0 1 3 2 2 4 1
Wrong answer if they connect black to white:
no
8 17
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8 4 3
The next three datasets have 4 moves inserted before the final move in the center.
no
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8
0 1 5 8 8 5 3 7 4 3
yes
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8
0 1 5 8 8 5 4 4 4 3
no
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8
0 1 5 8 8 3 4 4 4 3
yes
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8
0 1 5 8 8 5 3 3 4 3
no
10 99
5 4 7 9
7 3 8 7 1 8 8 10 5
5 5 3 10 7 7 10 4 1 2 2
9 5 3 5
3 9 9 8 4 8 4 2 2
1 2 4 10 4 4 0 0 7
7 0
1 1 9 7
1 7 9 10 0 1 3 7 10 1
7 1 2 3 7 7 7 2 4
5
5 1 6 0
7 4 9 3 3 6 1 4 9
1 2 5 0 9 5 10 4 4
1 3
2 6 1 2
9 9 5 8 4 3 3 10 8
6 1 10 4 7 7 8 6 7 2 10
6 6 5 9
10 6 3 0 5 2 3 3
0 5 8 2 10 5 5 0 4
6 8 8
1 9 2 0
2 9 8 5 0 3 2 8 7
6 1 6 8 1 5 7 7 5
3 4
8 3 6 4
9 6 2 7 0 6 1 0 10
8 6 8 5 6 4 10 10 2 6 1
10 3 4 9 3 1
The above points were randomly generated.
After all but last move, not connected:
After all 99 moves, connected:
yes
20 221
0 4 8 15 15
3 3 2 1 15 8 11 1 18 6
1 6 4 12 1 16 13 19 1
9 18 5 17 15 12 6 7 19 5 14 15 12 9 6 19 16 6 13 9 3 15 15 13
19 11 9 11 20 14 2 11 12 15 18 4 19 4 12 16 17 10 17 20 2 9 6 20
0 16 19 9 8 18 11 13 14 13 13 17 4 19 14 1 14 12 10 15 6 10 12 10
2 6 17 16 19 18 12 17 13 2 14 2 18 9 17 3 20 5 14 16 7 6 5 5
15 2 6 12 8 6
16 18 1 17 9 16 14 5 8 2 7 1
15 7 15 8 2 1
4 3 1 2 15 4 10 14 10 7 12 19 1 7 3 14 6 15 15 14 11 19 12 4
17 18 6 5 10 2
17 0 9 13 1 5 0 1 13 7
5 16 8 5 9 8 16 3
3 16 18 13 11 6 3 9 8 7 10 19 8 13 15 10 7 4 12 7 8 17 4 14
7 17 11 16 0 13 16 11 6 6 16 2 2 17 8 3 16 15 1 10 2 15 4 2
9 4 12 2 19 8
15 5 14 14 16 9 16 5 9 10 3 7
2 13 7 13 6 9
3 13 10 1 15 18 14 3 2 19 5 0 4 11 7 14 12 3 13 20 17 7 16 17
12 6 18 18 18 14 5 20 12 8 16 0 15 9 5 4 2 3 8 10 20 10 14 7
14 17 8 16 4 5 19 2 10 18 11 18 6 17 11 10 3 8 10 13 13 11 1 6
10 5 7 15 5 12
14 6 7 9 10 3 8 19 8 1
11 4 7 0 13 19 7 12
19 16 17 14 3 12 5 13 12 11 3 0 18 12 3 5 3 19 6 2 0 3 17 17
7 10 13 3 4 15 17 19 20 7 8 8 7 2 10 11 18 17 11 9 15 1 19 0
16 4 13 16 5 8 11 3 20 18 16 19 19 13 18 16 14 19 5 19 15 16 17 2
2 5 9 7 16 7 14 9 0 5
After all but last move, not connected:
After all 221 moves, connected:
yes
20 221
0 4 8 15 15
3 3 2 1 15 8 11 1 18 6
1 6 4 12 1 16 13 19 1
9 18 5 17 15 12 6 7 19 5 14 15 12 9 6 19 16 6 13 9 3 15 15 13
19 11 9 11 20 14 2 11 12 15 18 4 19 4 12 16 17 10 17 20 2 9 6 20
0 16 19 9 8 18 11 13 14 13 13 17 4 19 14 1 14 12 10 15 6 10 12 10
2 6 17 16 19 18 12 17 13 2 14 2 18 9 17 3 20 5 14 16 7 6 5 5
15 2 6 12 8 6
16 18 1 17 9 16 14 5 8 2 7 1
15 7 15 8 2 1
4 3 1 2 15 4 10 14 10 7 12 19 1 7 3 14 6 15 15 14 11 19 12 4
17 18 6 5 10 2
17 0 9 13 1 5 0 1 13 7
5 16 8 5 9 8 16 3
3 16 18 13 11 6 3 9 8 7 10 19 8 13 15 10 7 4 12 7 8 17 4 14
7 17 11 16 0 13 16 11 6 6 16 2 2 17 8 3 16 15 1 10 2 15 4 2
9 4 12 2 19 8
15 5 14 14 16 9 16 5 9 10 3 7
2 13 7 13 6 9
3 13 10 1 15 18 14 3 2 19 5 0 4 11 7 14 12 3 13 20 17 7 16 17
12 6 18 18 18 14 5 20 12 8 16 0 15 9 5 4 2 3 8 10 20 10 14 7
14 17 8 16 4 5 19 2 10 18 11 18 6 17 11 10 3 8 10 13 13 11 1 6
10 5 7 15 5 12
14 6 7 9 10 3 8 19 8 1
11 4 7 0 13 19 7 12
19 16 17 14 3 12 5 13 12 11 3 0 18 12 3 5 3 19 6 2 0 3 17 17
7 10 13 3 4 15 17 19 20 7 8 8 7 2 10 11 18 17 11 9 15 1 19 0
16 4 13 16 5 8 11 3 20 18 16 19 19 13 18 16 14 19 5 19 15 16 17 2
2 5 9 7 16 7 14 9 1 14
Moved last point so not connected at left:
no
10 97
5 4 7 9
7 3 8 7 1 8 8 10 5
5 5 3 10 7 7 10 4 1 2 2
9 5 3 5
3 9 9 8 4 8 4 2 2
1 2 4 10 4 4 0 0 7
7 0
1 1 9 7
1 7 9 10 0 1 3 7 10 1
7 1 2 3 7 7 7 2 4
5
5 1 6 0
7 4 9 3 3 6 1 4 9
1 2 5 0 9 5 10 4 4
1 3
2 6 1 2
9 9 5 8 4 3 3 10 8
6 1 10 4 7 7 8 6 7 2 10
6 6 5 9
10 6 3 0 5 2 3 3
0 5 8 2 10 5 5 0 4
6 8 8
1 9 2 0
2 9 8 5 0 3 2 8 7
6 1 6 8 1 5 7 7 5
3 4
8 3 6 4
9 6 2 7 0 6 1 0 10
8 6 8 5 6 4 10 10 2 6 1
10 3
Two moves less that 10-99 data above, not connected:
no
10 99
5 4 7 9
7 3 8 7 1 8 8 10 5
5 5 3 10 7 7 10 4 1 2 2
9 5 3 5
3 9 9 8 4 8 4 2 2
1 2 4 10 4 4 0 0 7
7 0
1 1 9 7
1 7 9 10 0 1 3 7 10 1
7 1 2 3 7 7 7 2 4
5
5 1 6 0
7 4 9 3 3 6 1 4 9
1 2 5 0 9 5 10 4 4
1 3
2 6 1 2
9 9 5 8 4 3 3 10 8
6 1 10 4 7 7 8 6 7 2 10
6 6 5 9
10 6 3 0 5 2 3 3
0 5 8 2 10 5 5 0 4
6 8 8
1 9 2 0
2 9 8 5 0 3 2 8 7
6 1 6 8 1 5 7 7 5
3 4
8 3 6 4
9 6 2 7 0 6 1 0 10
8 6 8 5 6 4 10 10 2 6 1
10 3 4 9 1 5
Last move changed in 10-99 data so not connected:
no
0 0