Codeforces Round 519 by Botan Investments


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

Examples
Input
5
1 1 1 5 1
Output
5
Input
5
2 2 3 2 2
Output
5
----------------------------------------------------------------------------------------------------
B. Lost Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 4 5
Output
5
1 2 3 4 5 
Input
5
1 3 5 6 8
Output
2
3 5 
Input
3
1 5 3
Output
1
3 
----------------------------------------------------------------------------------------------------
C. Smallest Word
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
bbab
Output
0 1 1 0
Input
aaaaa
Output
1 0 0 0 1
----------------------------------------------------------------------------------------------------
D. Mysterious Crime
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 2 3
2 3 1
Output
4
Input
5 6
1 2 3 4 5
2 3 1 4 5
3 4 5 1 2
3 5 4 2 1
2 3 5 4 1
1 2 3 4 5
Output
5
Input
2 2
1 2
2 1
Output
2
----------------------------------------------------------------------------------------------------
E. Train Hard, Win Easy
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 2
2 3
1 3
1 2
2 3
Output
3 0 3 
Input
3 3
1 2
2 3
1 3
1 2
2 3
1 3
Output
0 0 0 
Input
5 3
-1 3
2 4
1 1
3 5
2 2
1 4
2 3
3 5
Output
4 14 4 16 10 
----------------------------------------------------------------------------------------------------
F. Make It One
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
10 6 15
Output
3
Input
3
2 4 6
Output
-1
Input
7
30 60 21 42 70 15 30
Output
3
----------------------------------------------------------------------------------------------------
G. Speckled Band
time limit per test: 7 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
9
abcabcdce
7
1 6
4 7
5 9
6 9
1 9
3 6
4 4
Output
1
-1
4
3
2
2
-1
----------------------------------------------------------------------------------------------------
