Technocup 2019 - Elimination Round 3


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

Examples
Input
5 2
1 2 2 1 3
Output
1
Input
10 3
1 3 3 1 3 5 5 5 5 100
Output
14
----------------------------------------------------------------------------------------------------
B. Personalized Cup
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
tourist
Output
1 7
tourist
Input
MyNameIsLifeIAmForeverByYourSideMyNameIsLife
Output
3 15
MyNameIsLifeIAm
ForeverByYourSi
deMyNameIsL*ife
----------------------------------------------------------------------------------------------------
C. Playing Piano
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 4 2 2
Output
1 4 5 4 5 
Input
7
1 5 7 8 10 3 1
Output
1 2 3 4 5 4 3 
Input
19
3 3 7 9 8 8 8 8 7 7 7 7 5 3 3 3 3 8 8
Output
1 3 4 5 4 5 4 5 4 5 4 5 4 3 5 4 3 5 4 
----------------------------------------------------------------------------------------------------
D. Barcelonian Distance
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 -3
0 3 3 0
Output
4.2426406871
Input
3 1 -9
0 3 3 -1
Output
6.1622776602
----------------------------------------------------------------------------------------------------
E. The Unbearable Lightness of Weights
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 4 2 2
Output
2
Input
6
1 2 4 4 4 9
Output
2
----------------------------------------------------------------------------------------------------
F. Vasya and Maximum Matching
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
1 3
1 4
Output
4
Input
4
1 2
2 3
3 4
Output
6
Input
1
Output
1
----------------------------------------------------------------------------------------------------
G. Chattering
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 4 1
Output
2 2 1 2 
Input
8
1 2 2 1 5 1 3 1
Output
3 3 2 2 1 2 2 3 
----------------------------------------------------------------------------------------------------
