Codeforces Round 275 (Div. 1)


A. Diverse Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
Output
1 3 2
Input
3 1
Output
1 2 3
Input
5 2
Output
1 3 2 4 5
----------------------------------------------------------------------------------------------------
B. Interesting Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
1 3 3
Output
YES
3 3 3
Input
3 2
1 3 3
1 3 2
Output
NO
----------------------------------------------------------------------------------------------------
C. Game with Strings
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
aab
aac
Output
2.000000000000000
Input
3
aaA
aBa
Caa
Output
1.666666666666667
Input
3
aca
vac
wqq
Output
1.000000000000000
----------------------------------------------------------------------------------------------------
D. Random Function and Tree
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
5
1 2 2 1
1 2 3 4 5
5
P 3 4
P 4 5
V 2 3
P 5 2
P 1 4
Output
1.640000000
1.800000000
2.280000000
2.320000000
2.800000000
1.840000000
----------------------------------------------------------------------------------------------------
