Codeforces Round 210 (Div. 1)


A. Levko and Array Recovery
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
1 2 3 1
2 1 2 8
2 3 4 7
1 1 3 3
2 3 4 8
Output
YES
4 7 4 7
Input
4 5
1 2 3 1
2 1 2 8
2 3 4 7
1 1 3 3
2 3 4 13
Output
NO
----------------------------------------------------------------------------------------------------
B. Levko and Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
4 7 4 7 4
Output
0
Input
3 1
-100 0 100
Output
100
Input
6 3
1 2 3 7 8 9
Output
1
----------------------------------------------------------------------------------------------------
C. Levko and Strings
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
yz
Output
26
Input
2 3
yx
Output
2
Input
4 7
abcd
Output
21962
----------------------------------------------------------------------------------------------------
D. Levko and Sets
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 7
2
5
Output
3
Input
1 2 7
2
2 4
Output
3
Input
2 1 7
1 6
2
Output
1
Input
2 1 7
1 6
5
Output
2
----------------------------------------------------------------------------------------------------
E. Levko and Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1 3
1 3 4
3 2 2
1 2 1 3
2 4 1 3
3 4 1 3
Output
WIN
1 1 3 
Input
4 1 3
1 3 4
3 2 2
1 2 1 3
2 4 1 3
3 4 1 2
Output
DRAW
1 1 2 
Input
5 4 2
1 2 5
1 3 3
1 4 4
2 3 2
2 4 3
3 5 1 5
4 5 4 7
Output
LOSE
----------------------------------------------------------------------------------------------------
