Codeforces Round 259 (Div. 2)


A. Little Pony and Crystal Mine
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
*D*
DDD
*D*
Input
5
Output
**D**
*DDD*
DDDDD
*DDD*
**D**
Input
7
Output
***D***
**DDD**
*DDDDD*
DDDDDDD
*DDDDD*
**DDD**
***D***
----------------------------------------------------------------------------------------------------
B. Little Pony and Sort by Shift
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 1
Output
1
Input
3
1 3 2
Output
-1
Input
2
1 2
Output
0
----------------------------------------------------------------------------------------------------
C. Little Pony and Expected Maximum
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 1
Output
3.500000000000
Input
6 3
Output
4.958333333333
Input
2 2
Output
1.750000000000
----------------------------------------------------------------------------------------------------
D. Little Pony and Harmony Chest
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 1 1 1
Output
1 1 1 1 1 
Input
5
1 6 4 2 8
Output
1 5 3 1 8 
----------------------------------------------------------------------------------------------------
E. Little Pony and Summer Sun Celebration
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 2
2 3
1 1 1
Output
3
1 2 3
Input
5 7
1 2
1 3
1 4
1 5
3 4
3 5
4 5
0 1 0 1 0
Output
10
2 1 3 4 5 4 5 4 3 1 
Input
2 0
0 0
Output
0
----------------------------------------------------------------------------------------------------
