Bubble Cup 14 - Finals Online Mirror (Unrated, ICPC Rules, Teams Preferred, Div. 2)


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

Examples
Input
5
3 8 2 13 7
LLRLL
Output
3 L
2 R
8 R
13 L
7 L
----------------------------------------------------------------------------------------------------
B. Mars
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 8
17 0 12 6 10 8 2 4 5
2 3 12
2 3 6
2 4 6
4 6 2
2 8 2
1 2 17
1 8 2
9 9 14
Output
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Input
4 1
7 21 14 0
1 4 1000000000
Output
Yes
----------------------------------------------------------------------------------------------------
C. Restaurant Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
4
0 1
left right
Output
0
----------------------------------------------------------------------------------------------------
D. Hidden Fortress
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
1
2
1
Output
? 2 2
? 5 5
? 4 7
? 1 5
! 2 3 4 5
----------------------------------------------------------------------------------------------------
E. Array Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
5
Output
Alice
Input
3
5 4 5
Output
Alice
Input
6
5 8 2 1 10 9
Output
Bob
----------------------------------------------------------------------------------------------------
F. Party Organization
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 3
1 4
4 2
5 4
Output
1 2 3 5 6
Input
5 4
1 2
2 3
3 4
4 5
Output
-1
----------------------------------------------------------------------------------------------------
G. Bob's Beautiful Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 5
Output
YES
2 3
Input
3
1 2 3
Output
YES
0 1 2
Input
3
2 4 5
Output
NO
Input
4
1 3 5 7
Output
YES
6 -3 4 1
----------------------------------------------------------------------------------------------------
H. Shortest path
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
0 0
-1 1
2 -2
0 1
-2 2
Output
7.478709
----------------------------------------------------------------------------------------------------
I. Bubble Strike
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 1.0000
Output
6
----------------------------------------------------------------------------------------------------
J. Robot Factory
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
9 14 11 12 13
5 15 11 6 7
5 9 14 9 14
3 2 14 3 14
Output
9 4 4 2 1 
----------------------------------------------------------------------------------------------------
