VK Cup 2018 - Wild-card Round 1 (unofficial unrated mirror)


A. 2-3-numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 10
Output
7
Input
100 200
Output
5
Input
1 2000000000
Output
326
----------------------------------------------------------------------------------------------------
B. Add Points
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
-5 10 5
Output
1
Input
6
100 200 400 300 600 500
Output
0
Input
4
10 9 0 -1
Output
8
----------------------------------------------------------------------------------------------------
C. Is This a Zebra?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
0 0 0 1 1 1 0 0 0
Output
YES
Input
7
0 0 0 1 1 1 1
Output
NO
Input
5
1 1 1 1 1
Output
YES
Input
8
1 1 1 0 0 0 1 1
Output
NO
Input
9
1 1 0 1 1 0 1 1 0
Output
NO
----------------------------------------------------------------------------------------------------
D. Choose Place
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
..-**-..
..-**-..
..-..-..
..-..-..
..-..-..
..-..-..
Output
..-**-..
..-**-..
..-..-..
..-P.-..
..-..-..
..-..-..
Input
**-**-**
**-**-**
..-**-.*
**-**-**
..-..-..
..-**-..
Output
**-**-**
**-**-**
..-**-.*
**-**-**
..-P.-..
..-**-..
Input
**-**-*.
*.-*.-**
**-**-**
**-**-**
..-..-..
..-**-..
Output
**-**-*.
*.-*P-**
**-**-**
**-**-**
..-..-..
..-**-..
----------------------------------------------------------------------------------------------------
E. Merge Equal Elements
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
5 2 1 1 2 2
Output
2
5 4 
Input
4
1000000000 1000000000 1000000000 1000000000
Output
1
1000000002 
Input
7
4 10 22 11 12 5 6
Output
7
4 10 22 11 12 5 6 
----------------------------------------------------------------------------------------------------
F. Mobile Communications
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 6 7
2 13
4 20
7 9
Output
3
Input
5 4 100
10 70
15 76
21 12
30 100
67 85
Output
26
----------------------------------------------------------------------------------------------------
G. Large Bouquets
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 3 4 2 7
Output
2
Input
6
2 2 6 8 6 12
Output
0
Input
3
11 4 10
Output
1
----------------------------------------------------------------------------------------------------
H. Endless Roses Most Beautiful
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
4 3 4 1 6
RROWW
Output
11
Input
5 2
10 20 14 20 11
RRRRR
Output
-1
Input
11 5
5 6 3 2 3 4 7 5 4 5 6
RWOORWORROW
Output
28
----------------------------------------------------------------------------------------------------
I. A Vital Problem
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
05:43
Output
23:59
Input
4
22:00
03:21
16:03
09:59
Output
06:37
----------------------------------------------------------------------------------------------------
J. Segments
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 3
4 5
2 4
Output
1 2 1 
Input
9
10 20
50 60
30 40
70 80
90 100
60 70
10 40
40 50
80 90
Output
1 2 3 4 5 4 3 2 1 
----------------------------------------------------------------------------------------------------
