Educational Codeforces Round 54 (Rated for Div. 2)


A. Minimizing the String
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
aaa
Output
aa
Input
5
abcda
Output
abca
----------------------------------------------------------------------------------------------------
B. Divisor Subtraction
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
Output
1
Input
4
Output
2
----------------------------------------------------------------------------------------------------
C. Meme Problem
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
69
0
1
4
5
999
1000
Output
Y 67.985071301 1.014928699
Y 0.000000000 0.000000000
N
Y 2.000000000 2.000000000
Y 3.618033989 1.381966011
Y 997.998996990 1.001003010
Y 998.998997995 1.001002005
----------------------------------------------------------------------------------------------------
D. Edge Deletion
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 2
1 2 1
3 2 1
1 3 3
Output
2
1 2 
Input
4 5 2
4 1 8
2 4 1
2 1 3
3 4 9
3 1 5
Output
2
3 2 
----------------------------------------------------------------------------------------------------
E. Vasya and a Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2
1 3
2 4
2 5
3
1 1 1
2 0 10
4 10 100
Output
1 11 1 100 0 
Input
5
2 3
2 1
5 4
3 4
5
2 0 4
3 10 1
1 2 3
2 3 10
1 1 7
Output
10 24 14 11 11 
----------------------------------------------------------------------------------------------------
F. Summer Practice Report
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
5 5
2 2
Output
YES
Input
2 2
5 6
2 2
Output
NO
Input
4 1
4 1 10 1
3 2 10 1
Output
YES
----------------------------------------------------------------------------------------------------
G. Array Game
time limit per test: 6 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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