MemSQL Start[c]UP 3.0 - Round 2 (onsite finalists)


A. Save the problem!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
18
Output
30 4
1 5 10 25
Input
3
Output
20 2
5 2
Input
314
Output
183 4
6 5 2 139
----------------------------------------------------------------------------------------------------
B. Ordering Pizza
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 12
3 5 7
4 6 7
5 9 5
Output
84
Input
6 10
7 4 7
5 8 8
12 5 8
6 11 6
3 3 7
5 9 6
Output
314
----------------------------------------------------------------------------------------------------
C. Gotta Go Fast
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 8
2 8 81
Output
3.14
Input
2 30
20 30 80
3 9 85
Output
31.4
Input
4 319
63 79 89
79 97 91
75 87 88
75 90 83
Output
314.159265358
----------------------------------------------------------------------------------------------------
D. Buy Low Sell High
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
10 5 4 7 9 12 6 2 10
Output
20
Input
20
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4
Output
41
----------------------------------------------------------------------------------------------------
E. Hex Dyslexia
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
f1e
Output
NO
Input
0f1e
Output
00f1
Input
12d2c
Output
00314
----------------------------------------------------------------------------------------------------
F. Egg Roulette
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
??BB
Output
0
Input
2 4
?BA??B??A???
Output
1
Input
4 14
????A??BB?????????????AB????????????
Output
314
----------------------------------------------------------------------------------------------------
G. Flowers and Chocolate
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3 3
3 5
10 3 7
Output
17
Input
6 5 10
9 3 3 4 9 9
9 9 1 6 4
Output
31415926
----------------------------------------------------------------------------------------------------
