Codeforces Round 693 (Div. 3)


A. Cards for Friends
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 2 3
3 3 2
5 10 2
11 13 1
1 4 4
Output
YES
NO
YES
YES
YES
----------------------------------------------------------------------------------------------------
B. Fair Division
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2
1 1
2
1 2
4
1 2 1 2
3
2 2 2
3
2 1 2
Output
YES
NO
YES
NO
NO
----------------------------------------------------------------------------------------------------
C. Long Jumps
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
7 3 1 2 3
3
2 1 4
6
2 1000 2 3 995 1
5
1 1 1 1 1
Output
7
6
1000
5
----------------------------------------------------------------------------------------------------
D. Even-Odd Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
5 2 7 3
3
3 2 1
4
2 2 2 2
2
7 8
Output
Bob
Tie
Alice
Alice
----------------------------------------------------------------------------------------------------
E. Correct Placement
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
3 4
5 4
3 3
3
1 3
2 2
3 1
4
2 2
3 1
6 3
5 4
4
2 2
2 3
1 1
4 4
Output
-1 3 -1 
-1 -1 -1 
-1 -1 2 2 
3 3 -1 3 
----------------------------------------------------------------------------------------------------
F. New Year's Puzzle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 2
2 2
1 4
3 2
2 1
2 3
6 4
2 1
2 3
2 4
2 6
Output
YES
NO
NO
----------------------------------------------------------------------------------------------------
G. Moving to the Capital
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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