Codeforces Round 746 (Div. 2)


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

Examples
Input
3
2 4
3 7
2 6
4 2
3 11
2 1 7
Output
1
2
3
----------------------------------------------------------------------------------------------------
B. Hemose Shopping
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 3
3 2 1
4 3
1 2 3 4
5 2
5 1 2 3 4
5 4
1 2 3 4 4
Output
NO
YES
YES
YES
----------------------------------------------------------------------------------------------------
C. Bakry and Partitioning
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 2
1 3
1 2
5 5
3 3 3 3 3
1 2
2 3
1 4
4 5
5 2
1 7 2 3 5
1 2
2 3
1 4
4 5
5 3
1 6 4 1 2
1 2
2 3
1 4
4 5
3 3
1 7 4
1 2
2 3
Output
NO
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
D. Hemose in ICPC ?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1 2
2 3
2 4
1 5
5 6
10
2
10
Output
? 6 1 2 3 4 5 6
? 3 3 1 5
? 2 1 2
! 1 2
----------------------------------------------------------------------------------------------------
E. Bored Bakry
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 6
Output
2
Input
3
2 4 3
Output
0
Input
6
8 1 3 3 1 2
Output
4
----------------------------------------------------------------------------------------------------
F1. Alice and Recoloring 1
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
WWW
WBB
WBB
Output
3
Input
10 15
WWWBBBWBBBBBWWW
BBBBWWWBBWWWBBB
BBBWWBWBBBWWWBB
BBWBWBBWWWBBWBW
BBBBWWWBBBWWWBB
BWBBWWBBBBBBWWW
WBWWBBBBWWBBBWW
WWBWWWWBBWWBWWW
BWBWWBWWWWWWBWB
BBBWBWBWBBBWWBW
Output
74
----------------------------------------------------------------------------------------------------
F2. Alice and Recoloring 2
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
WWW
WBB
WBB
Output
2
Input
10 15
WWWBBBWBBBBBWWW
BBBBWWWBBWWWBBB
BBBWWBWBBBWWWBB
BBWBWBBWWWBBWBW
BBBBWWWBBBWWWBB
BWBBWWBBBBBBWWW
WBWWBBBBWWBBBWW
WWBWWWWBBWWBWWW
BWBWWBWWWWWWBWB
BBBWBWBWBBBWWBW
Output
68
----------------------------------------------------------------------------------------------------
