Educational Codeforces Round 150 (Rated for Div. 2)


A. Game with Board
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
3
6
Output
Bob
Alice
----------------------------------------------------------------------------------------------------
B. Keep it Beautiful
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
9
3 7 7 9 2 4 6 3 4
5
1 1 1 1 1
5
3 2 1 2 3
Output
111110010
11111
11011
----------------------------------------------------------------------------------------------------
C. Ranom Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
DAAABDCA
AB
ABCDEEDCBA
DDDDAAADDABECD
Output
11088
10010
31000
15886
----------------------------------------------------------------------------------------------------
D. Pairs of Segments
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
7
2 4
9 12
2 4
7 7
4 8
10 13
6 8
5
2 2
2 8
0 10
1 2
5 6
4
1 1
2 2
3 3
4 4
Output
1
3
4
----------------------------------------------------------------------------------------------------
E. Fill the Matrix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
3
0 0 0
9
4
2 0 3 1
5
4
2 0 3 1
6
4
2 0 3 1
10
10
0 2 2 1 5 10 3 4 1 1
20
1
1
0
Output
6
3
4
4
16
0
----------------------------------------------------------------------------------------------------
F. Monocarp and a Strategic Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
0 0 1 0
1 3 4 2
2 5 1 2
4 5 4 3
1 4 4 5
Output
85
Input
4
3 3 1 5
5 1 5 3
4 4 4 1
1 3 4 4
Output
41
----------------------------------------------------------------------------------------------------
