COMPFEST 13 - Finals Online Mirror (Unrated, ICPC Rules, Teams Preferred)


A. Another Sorting Problem
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 2
AA
AB
BB
BA
AZ
Output
5 2 1 3 4
----------------------------------------------------------------------------------------------------
B. Building an Amusement Park
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
8 4
-3 1
-4 4
1 5
2 2
2 -2
-2 -4
-1 -1
-6 0
Output
3.1622776589
Input
1 1
0 0
Output
0.0000000000
----------------------------------------------------------------------------------------------------
C. Cyclic Sum
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 1 5
1 2 3 4 3
Output
4
Input
5 1 5
1 2 3 4 5
Output
5
Input
5 4 5
1 2 3 4 5
Output
125
----------------------------------------------------------------------------------------------------
D. Divisible by Twenty-Five
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
25
Output
1
Input
_00
Output
9
Input
_XX
Output
9
Input
0
Output
1
Input
0_25
Output
0
----------------------------------------------------------------------------------------------------
E. Eye-Pleasing City Park Tour
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 0
1 3 2 6 4
1 2 1
1 4 0
3 2 1
2 5 0
Output
45
Input
3 1
1 1 1
1 2 1
3 2 0
Output
10
----------------------------------------------------------------------------------------------------
F. Finding Expected Value
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 2
0 1
Output
2
Input
2 2
0 -1
Output
1
Input
3 3
0 1 1
Output
12
Input
3 3
-1 -1 -1
Output
11
Input
10 9
-1 0 -1 1 1 2 2 3 3 3
Output
652419213
----------------------------------------------------------------------------------------------------
G. GCD Festival
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
3 6 2 1 4
Output
77
----------------------------------------------------------------------------------------------------
H. Holiday Wall Ornaments
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
9 3
100101011
101
Output
1 1 0 1 6 -1 -1 -1
----------------------------------------------------------------------------------------------------
I. Illusions of the Desert
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6 4
10 -9 2 -1 4 -6
1 5
5 4
5 6
6 2
6 3
2 1 2
1 1 -3
2 1 2
2 3 3
Output
39
32
0
----------------------------------------------------------------------------------------------------
J. Jeopardy of Dropped Balls
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 5 3
1 2 3 3 3
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
1 2 1
Output
2 2 1 
Input
1 2 2
1 3
1 2
Output
1 2 
----------------------------------------------------------------------------------------------------
K. Knitting Batik
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 3 2 2 2
1 1 2 2
Output
32
Input
4 5 170845 2 2
1 4 3 1
Output
756680455
----------------------------------------------------------------------------------------------------
L. Longest Array Deconstruction
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7
2 1 4 2 5 3 7
Output
3
Input
4
4 2 3 1
Output
2
----------------------------------------------------------------------------------------------------
M. Managing Telephone Poles
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 2
101
000
000
Output
18
Input
5 4
10010
00000
01000
00001
00100
00010
Output
36
----------------------------------------------------------------------------------------------------
