Educational Codeforces Round 80 (Rated for Div. 2)


A. Deadline
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1
4 5
5 11
Output
YES
YES
NO
----------------------------------------------------------------------------------------------------
B. Yet Another Meme Problem
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 11
4 2
191 31415926
Output
1
0
1337
----------------------------------------------------------------------------------------------------
C. Two Arrays
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
Output
5
Input
10 1
Output
55
Input
723 9
Output
157557417
----------------------------------------------------------------------------------------------------
D. Minimax Problem
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6 5
5 0 3 1 2
1 8 9 1 3
1 2 3 4 5
9 1 0 3 7
2 3 0 6 3
6 4 1 7 0
Output
1 5
----------------------------------------------------------------------------------------------------
E. Messenger Simulator
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
3 5 1 4
Output
1 3
2 5
1 4
1 5
1 5
Input
4 3
1 2 4
Output
1 3
1 2
3 4
1 4
----------------------------------------------------------------------------------------------------
F. Red-Blue Graph
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 2 6 10 15
RRB
UB
3 2
2 2
1 2
1 1
2 1
1 1
Output
35
BUURRU
Input
3 1 3 4 5
RRR
B
2 1
1 1
3 1
Output
-1
Input
3 1 3 4 5
URU
B
2 1
1 1
3 1
Output
14
RBB
----------------------------------------------------------------------------------------------------
