CEOI 2019 day 2 online mirror (unrated, IOI format)


A. Amusement Park
time limit per test: 3 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
2 1
1 2
Output
1
Input
3 3
1 2
2 3
1 3
Output
9
----------------------------------------------------------------------------------------------------
B. Magic Tree
time limit per test: 2 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
6 4 10
1
2
1
4
4
3 4 5
4 7 2
5 4 1
6 9 3
Output
9
----------------------------------------------------------------------------------------------------
C. Scissors and Tape
time limit per test: 1 second
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
6 0 0 6 0 6 4 5 4 5 9 0 9
4 0 0 7 0 7 7 0 7
Output
scissors
0 5
3 0 0 3 0 3 4
3 3 4 0 4 0 0
3 3 0 6 0 6 4
3 6 4 3 4 3 0
4 0 4 5 4 5 9 0 9
tape
5 1 2 5 3 4
3 0 3 0 0 4 0
3 4 0 7 0 7 4
4 0 3 4 0 7 4 3 7
3 7 4 7 7 3 7
3 3 7 0 7 0 3
4 0 0 7 0 7 7 0 7
Input
4 0 0 3 0 3 3 0 3
4 7 -1 10 -1 11 2 8 2
Output
scissors
0 2
3 0 0 1 3 0 3
4 1 3 0 0 3 0 3 3
tape
2 1 2
3 110 -1 111 2 110 2
4 108 2 107 -1 110 -1 110 2
4 107 -1 110 -1 111 2 108 2
Input
4 0 0 9 0 9 1 0 1
4 0 0 3 0 3 3 0 3
Output
scissors
0 2
4 1.470000000 0 9 0 9 1 1.470000000 1
4 0 0 1.470000000 0 1.470000000 1 0 1
scissors
1 2
4 1.470000000 0 6 0 6 1 1.470000000 1
4 9 0 9 1 6 1 6 0
tape
2 4 3
4 3 2 3 1 6 1 6 2
4 6 1 1.470000000 1 1.470000000 0 6 0
6 1.470000000 0 6 0 6 2 3 2 3 1 1.470000000 1
scissors
5 4
4 1.470000000 0 3 0 3 1 1.470000000 1
4 3 0 4 0 4 2 3 2
4 4 2 4 0 5 0 5 2
4 5 0 6 0 6 2 5 2
tape
5 2 6 7 8 9
4 0 0 1.470000000 0 1.470000000 1 0 1
4 1.470000000 0 3 0 3 1 1.470000000 1
4 0 2 0 1 2 1 2 2
4 0 2 2 2 2 3 0 3
4 3 3 2 3 2 1 3 1
4 0 0 3 0 3 3 0 3
----------------------------------------------------------------------------------------------------
