Educational Codeforces Round 121 (Rated for Div. 2)


A. Equidistant Letters
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
oelhl
abcdcba
ac
Output
hello
ababcdc
ac
----------------------------------------------------------------------------------------------------
B. Minor Reduction
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
10057
90
Output
10012
9
----------------------------------------------------------------------------------------------------
C. Monsters And Spells
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
6
4
2
4 5
2 2
3
5 7 9
2 1 2
Output
10
6
7
----------------------------------------------------------------------------------------------------
D. Martial Arts Tournament
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
3 1 2 1
1
1
6
2 2 2 1 1 1
8
6 3 6 3 6 3 6 6
Output
0
2
3
2
----------------------------------------------------------------------------------------------------
E. Black and White Tree
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
8
0 1 0 0 0 0 1 0
8 6
2 5
7 8
6 5
4 5
6 1
7 3
Output
0 1 1 1 1 0 1 1 
----------------------------------------------------------------------------------------------------
F. A Random Code Problem
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 10 3 5 13 88
Output
382842030
Input
2 15363 270880 34698 17 2357023
Output
319392398
----------------------------------------------------------------------------------------------------
