CROC 2016 - Final Round [Private, For Onsite Finalists Only]


A. Gambling Nim
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
1 1
1 1
Output
0/1
Input
2
1 2
1 2
Output
1/2
Input
3
0 4
1 5
2 3
Output
1/1
----------------------------------------------------------------------------------------------------
B. Graph Coloring
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 2 B
3 1 R
3 2 B
Output
1
2 
Input
6 5
1 3 R
2 3 R
3 4 B
4 5 R
4 6 R
Output
2
3 4 
Input
4 5
1 2 R
1 3 R
2 3 B
3 4 B
1 4 B
Output
-1
----------------------------------------------------------------------------------------------------
C. Binary Table
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
0110
1010
0111
Output
2
----------------------------------------------------------------------------------------------------
D. International Olympiad
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
IAO'15
IAO'2015
IAO'1
IAO'9
IAO'0
Output
2015
12015
1991
1989
1990
Input
4
IAO'9
IAO'99
IAO'999
IAO'9999
Output
1989
1999
2999
9999
----------------------------------------------------------------------------------------------------
E. To Hack or not to Hack
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
120 120 1
61 61 120
-61 61 120
0 0 0
Output
1
Input
4
0 0 119
-3 -17 -42
0 7 0
51 0 0
Output
2
----------------------------------------------------------------------------------------------------
