Mail.Ru Cup 2018 - Practice Round


A. Bmail Computer Network
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
1 1 2 2 3 2 5
Output
1 2 5 8 
Input
6
1 2 3 4 5
Output
1 2 3 4 5 6 
Input
7
1 1 2 3 4 3
Output
1 3 7 
----------------------------------------------------------------------------------------------------
B. DDoS
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
100 200 1 1 1
Output
3
Input
5
1 2 3 4 5
Output
0
Input
2
101 99
Output
1
----------------------------------------------------------------------------------------------------
C. Tanya and Colored Candies
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3 10
1 2 3 4 5
RGBRR
Output
4
Input
2 1 15
5 6
RG
Output
-1
----------------------------------------------------------------------------------------------------
