Lyft Level 5 Challenge 2018 - Elimination Round


A. King Escape
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
4 4
1 3
3 1
Output
YES
Input
8
4 4
2 3
1 6
Output
NO
Input
8
3 5
1 2
6 1
Output
NO
----------------------------------------------------------------------------------------------------
B. Square Difference
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
6 5
16 13
61690850361 24777622630
34 33
Output
YES
NO
NO
YES
----------------------------------------------------------------------------------------------------
C. Permutation Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
3 6 5 4 2 7 1 8
Output
BAAAABAB
Input
15
3 11 2 5 10 9 7 13 15 8 4 12 6 1 14
Output
ABAAAABBBAABAAB
----------------------------------------------------------------------------------------------------
D. Divisors
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
9
15
143
Output
32
Input
1
7400840699802997
Output
4
Input
8 
4606061759128693
4606066102679989
4606069767552943
4606063116488033
4606063930903637
4606064745319241
4606063930904021
4606065559735517
Output
1920
Input
3
4
8
16
Output
10
----------------------------------------------------------------------------------------------------
E. Hidden Bipartite Graph
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
0
1
1
1
0
Output
? 4 
1 2 3 4
? 2
1 2
? 2
1 3
? 2
1 4
? 2
2 4
? 2
3 4
Y 2
1 2
Input
4
4
3
Output
? 4
1 4 2 3
? 3
1 2 4
N 3
2 1 4
----------------------------------------------------------------------------------------------------
F. Boolean Computer
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3 1
13 10 6
AXoA
Output
3
Input
1 7 6
0 1 1 0 1 0 0
A
O
X
a
o
x
Output
40
16
25
9
33
24
Input
6 2 4
47 12
AOXaox
AAaaAA
xxxxxx
XXXXXX
Output
2
3
0
2
Input
2 2 2
2 0
xO
Ox
Output
2
0
----------------------------------------------------------------------------------------------------
G. Chip Game
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
4 5
Output
1 1 1 1
Input
2 20
4 5
Output
82 82 6 230
----------------------------------------------------------------------------------------------------
