Codeforces Round 236 (Div. 2)


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

Examples
Input
3 10 3 3
Output
2
Input
3 10 1 3
Output
3
Input
100 100 1 1000
Output
1
----------------------------------------------------------------------------------------------------
B. Trees in a Row
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1
1 2 1 5
Output
2
+ 3 2
- 4 1
Input
4 1
1 2 3 4
Output
0
----------------------------------------------------------------------------------------------------
C. Searching for Graph
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
6 0
Output
1 2
1 3
1 4
1 5
1 6
2 3
2 4
2 5
2 6
3 4
3 5
3 6
----------------------------------------------------------------------------------------------------
D. Upgrading Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
4 20 34 10 10
2 5
Output
-2
Input
4 5
2 4 8 16
3 5 7 11 17
Output
10
----------------------------------------------------------------------------------------------------
E. Strictly Positive Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 0
0 1
Output
NO
Input
5
4 5 6 1 2
1 2 3 4 5
6 4 1 2 4
1 1 1 1 1
4 4 4 4 4
Output
YES
----------------------------------------------------------------------------------------------------
