Codeforces Round 337 (Div. 2)


A. Pasha and Stick
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
Output
1
Input
20
Output
4
----------------------------------------------------------------------------------------------------
B. Vika and Squares
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 4 2 3 3
Output
12
Input
3
5 5 5
Output
15
Input
6
10 10 10 1 10 10
Output
11
----------------------------------------------------------------------------------------------------
C. Harmony Analysis
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
Output
++**
+*+*
++++
+**+
----------------------------------------------------------------------------------------------------
D. Vika and Segments
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 1 2 1
1 4 1 2
0 3 2 3
Output
8
Input
4
-2 -1 2 -1
2 1 -2 1
-1 -2 -1 2
1 2 1 -2
Output
16
----------------------------------------------------------------------------------------------------
E. Alphabet Permutations
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7 4 3
abacaba
1 3 5 b
2 abc
1 4 4 c
2 cba
Output
6
5
----------------------------------------------------------------------------------------------------
