Codeforces Round 478 (Div. 2)


A. Aramic script
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
----------------------------------------------------------------------------------------------------
B. Mancala
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 1 1 0 0 0 0 0 0 7 0 0 0 0
Output
4
Input
5 1 1 1 1 0 0 0 0 0 0 0 0 0
Output
8
----------------------------------------------------------------------------------------------------
C. Valhalla Siege
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
1 2 1 2 1
3 10 1 1 1
Output
3
5
4
4
3
Input
4 4
1 2 3 4
9 1 10 6
Output
1
4
4
1
----------------------------------------------------------------------------------------------------
D. Ghosts
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1 1
1 -1 -1
2 1 1
3 1 1
4 -1 -1
Output
8
Input
3 1 0
-1 1 0
0 0 -1
1 -1 -2
Output
6
Input
3 1 0
0 0 0
1 0 0
2 0 0
Output
0
----------------------------------------------------------------------------------------------------
E. Hag's Khashba
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
0 0
2 0
2 2
1 1 2
2 1
2 2
2 3
Output
3.4142135624 -1.4142135624
2.0000000000 0.0000000000
0.5857864376 -1.4142135624
Input
3 2
-1 1
0 0
1 1
1 1 2
2 1
Output
1.0000000000 -1.0000000000
----------------------------------------------------------------------------------------------------
