Codeforces Round 277.5 (Div. 2)


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

Examples
Input
5
5 2 5 1 4
Output
2
0 3
4 2
Input
6
10 20 20 40 60 60
Output
0
Input
2
101 100
Output
1
0 1
----------------------------------------------------------------------------------------------------
B. BerSU Ball
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 4 6 2
5
5 1 5 7 9
Output
3
Input
4
1 2 3 4
4
10 11 12 13
Output
0
Input
5
1 1 1 1 1
3
1 2 3
Output
2
----------------------------------------------------------------------------------------------------
C. Given Length and Sum of Digits...
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 15
Output
69 96
Input
3 0
Output
-1 -1
----------------------------------------------------------------------------------------------------
D. Unbearable Controversy of Being
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
1 2
2 3
1 4
4 3
Output
1
Input
4 12
1 2
1 3
1 4
2 1
2 3
2 4
3 1
3 2
3 4
4 1
4 2
4 3
Output
12
----------------------------------------------------------------------------------------------------
E. Hiking
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 9
10 10
20 10
30 1
31 5
40 10
Output
1 2 4 5 
----------------------------------------------------------------------------------------------------
F. Special Matrices
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1 1000
011
Output
2
Input
4 4 100500
0110
1010
0101
1001
Output
1
----------------------------------------------------------------------------------------------------
