Technocup 2019 - Elimination Round 4


A. Right-Left Cipher
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
ncteho
Output
techno
Input
erfdcoeocs
Output
codeforces
Input
z
Output
z
----------------------------------------------------------------------------------------------------
B. Div Times Mod
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 3
Output
11
Input
1 2
Output
3
Input
4 6
Output
10
----------------------------------------------------------------------------------------------------
C. Connect Three
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 0
1 1
2 2
Output
5
0 0
1 0
1 1
1 2
2 2
Input
0 0
2 0
1 1
Output
4
0 0
1 0
1 1
2 0
----------------------------------------------------------------------------------------------------
D. Minimum Diameter Tree
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 2
1 3
1 4
Output
2.000000000000000000
Input
6 1
2 1
2 3
2 5
5 4
5 6
Output
0.500000000000000000
Input
5 5
1 2
2 3
3 4
3 5
Output
3.333333333333333333
----------------------------------------------------------------------------------------------------
E. Vasya and Templates
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4
bbcb
aada
aada
3
abc
bbb
bbb
Output
YES
badc
NO
----------------------------------------------------------------------------------------------------
F. Rock-Paper-Scissors Champion
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5
RPS
1 S
2 R
3 P
1 P
2 P
Output
2
2
1
2
2
3
----------------------------------------------------------------------------------------------------
G. Beautiful Matrix
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 1
1 2
Output
1
Input
3
1 2 3
2 3 1
3 1 2
Output
1
Input
3
1 2 3
3 1 2
2 3 1
Output
3
----------------------------------------------------------------------------------------------------
