Codeforces Round 190 (Div. 1)


A. Ciel and Robot
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
RU
Output
Yes
Input
1 2
RU
Output
No
Input
-1 1000000000
LRRLU
Output
Yes
Input
0 0
D
Output
Yes
----------------------------------------------------------------------------------------------------
B. Ciel and Duel
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
ATK 2000
DEF 1700
2500
2500
2500
Output
3000
Input
3 4
ATK 10
ATK 100
ATK 1000
1
11
101
1001
Output
992
Input
2 4
DEF 0
ATK 0
0
0
1
1
Output
1
----------------------------------------------------------------------------------------------------
C. Ciel the Commander
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
1 3
1 4
Output
A B B B
Input
10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
Output
D C B A D C B D C D
----------------------------------------------------------------------------------------------------
D. Ciel and Flipboard
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
-1 -1 1
-1 1 -1
1 -1 -1
Output
9
Input
5
-2 0 0 0 -2
0 -2 0 -2 0
0 0 -2 0 0
0 -2 0 -2 0
-2 0 0 0 -2
Output
18
----------------------------------------------------------------------------------------------------
E. Ciel and Gondolas
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 2
0 0 1 1 1
0 0 1 1 1
1 1 0 0 0
1 1 0 0 0
1 1 0 0 0
Output
0
Input
8 3
0 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1
1 1 0 1 1 1 1 1
1 1 1 0 1 1 1 1
1 1 1 1 0 1 1 1
1 1 1 1 1 0 1 1
1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 0
Output
7
Input
3 2
0 2 0
2 0 3
0 3 0
Output
2
----------------------------------------------------------------------------------------------------
