Codeforces Round 363 (Div. 2)


A. Launch of Collider
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
RLRL
2 4 6 10
Output
1
Input
3
LLR
40 50 60
Output
-1
----------------------------------------------------------------------------------------------------
B. One Bomb
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
.*..
....
.*..
Output
YES
1 2
Input
3 3
..*
.*.
*..
Output
NO
Input
6 5
..*..
..*..
*****
..*..
..*..
..*..
Output
YES
3 3
----------------------------------------------------------------------------------------------------
C. Vacations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 3 2 0
Output
2
Input
7
1 3 3 2 1 2 3
Output
0
Input
2
2 2
Output
1
----------------------------------------------------------------------------------------------------
D. Fix a Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 3 3 4
Output
1
2 3 4 4 
Input
5
3 2 2 5 3
Output
0
3 2 2 5 3 
Input
8
2 3 5 4 1 6 6 7
Output
2
2 3 7 8 1 6 6 7
----------------------------------------------------------------------------------------------------
E. LRU
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
0.3 0.2 0.5
Output
0.3 0.2 0.5 
Input
2 1
0.0 1.0
Output
0.0 1.0 
Input
3 2
0.3 0.2 0.5
Output
0.675 0.4857142857142857 0.8392857142857143 
Input
3 3
0.2 0.3 0.5
Output
1.0 1.0 1.0 
----------------------------------------------------------------------------------------------------
F. Limak and Shooting Points
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4
-2 -1
4 5
4 2
2 1
4 -1
1 -1
Output
3
Input
3 8
10 20
0 0
20 40
300 600
30 60
170 340
50 100
28 56
90 180
-4 -8
-1 -2
Output
5
----------------------------------------------------------------------------------------------------
