Codeforces Round 418 (Div. 2)


A. An abandoned sentiment from past
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
11 0 0 14
5 4
Output
Yes
Input
6 1
2 3 0 8 9 10
5
Output
No
Input
4 1
8 94 0 4
89
Output
Yes
Input
7 7
0 0 0 0 0 0 0
1 2 3 4 5 6 7
Output
Yes
----------------------------------------------------------------------------------------------------
B. An express train to reveries
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 4 3
1 2 5 4 5
Output
1 2 5 4 3
Input
5
4 4 2 3 1
5 4 5 3 1
Output
5 4 2 3 1
Input
4
1 1 3 4
1 4 3 4
Output
1 2 3 4
----------------------------------------------------------------------------------------------------
C. An impassioned circulation of affection
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
koyomi
3
1 o
4 o
4 m
Output
3
6
5
Input
15
yamatonadeshiko
10
1 a
2 a
3 a
4 a
5 a
1 b
2 b
3 b
4 b
5 b
Output
3
4
5
7
8
1
2
3
4
5
Input
10
aaaaaaaaaa
2
10 b
10 z
Output
10
10
----------------------------------------------------------------------------------------------------
D. An overnight dance in discotheque
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 1 6
0 4 1
2 -1 3
1 -2 1
4 -1 1
Output
138.23007676
Input
8
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
Output
289.02652413
----------------------------------------------------------------------------------------------------
E. An unavoidable detour for home
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 2 3 2
Output
1
Input
5
2 3 3 2 2
Output
2
Input
5
2 2 2 2 2
Output
2
Input
20
2 2 2 2 3 2 3 2 2 2 2 2 2 2 2 2 2 3 3 2
Output
82944
----------------------------------------------------------------------------------------------------
