Educational Codeforces Round 110 (Rated for Div. 2)


A. Fair Playoff
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 7 9 5
4 5 6 9
5 3 8 1
6 5 3 2
Output
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
B. Array Reodering
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
3 6 5 3
2
1 7
5
1 4 2 4 1
Output
4
0
9
----------------------------------------------------------------------------------------------------
C. Unstable String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0?10
???
?10??1100
Output
8
6
25
----------------------------------------------------------------------------------------------------
D. Playoff Tournament
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0110?11
6
5 1
6 ?
7 ?
1 ?
5 ?
1 1
Output
1
2
3
3
5
4
----------------------------------------------------------------------------------------------------
E. Gold Transfer
time limit per test: 4.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5 2
2 0 2
1 0 3 4
2 2 4
1 0 1 3
2 4 2
Output
2 4
4 10
1 3
----------------------------------------------------------------------------------------------------
F. String Distance
time limit per test: 2 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
4
zzz
bac
abc
acb
Output
4015
Input
2
a
b
Output
1337
----------------------------------------------------------------------------------------------------
