Codeforces Round 472 (rated, Div. 2, based on VK Cup 2018 Round 2)


A. Tritonic Iridescence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
CY??Y
Output
Yes
Input
5
C?C?Y
Output
Yes
Input
5
?CYC?
Output
Yes
Input
5
C??MM
Output
No
Input
3
MMY
Output
No
----------------------------------------------------------------------------------------------------
B. Mystical Mosaic
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 8
.#.#..#.
.....#..
.#.#..#.
#.#....#
.....#..
Output
Yes
Input
5 5
..#..
..#..
#####
..#..
..#..
Output
No
Input
5 9
........#
#........
..##.#...
.......#.
....#.#.#
Output
No
----------------------------------------------------------------------------------------------------
C. Three-level Laser
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 3 5 7
Output
0.5
Input
10 8
10 13 15 16 17 19 20 22 24 25
Output
0.875
Input
3 1
2 5 10
Output
-1
----------------------------------------------------------------------------------------------------
D. Riverside Curio
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
0 1 0 3 0 2
Output
6
Input
5
0 1 2 1 2
Output
1
Input
5
0 1 1 2 2
Output
0
----------------------------------------------------------------------------------------------------
E. Contact ATC
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1
-3 2
-3 3
-1 2
1 -3
3 -5
Output
3
Input
6 1
-3 2
-2 2
-1 2
1 -2
2 -2
3 -2
Output
9
----------------------------------------------------------------------------------------------------
