Educational Codeforces Round 163 (Rated for Div. 2)


A. Special Characters
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
6
1
2
Output
YES
AAABAACC
NO
YES
MM
----------------------------------------------------------------------------------------------------
B. Array Fix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
12 3 45 67
3
12 28 5
2
0 0
Output
YES
NO
YES
----------------------------------------------------------------------------------------------------
C. Arrow Path
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
>><<
>>><
2
><
><
4
>>><
>><<
6
>><<><
><>>><
Output
YES
YES
NO
YES
----------------------------------------------------------------------------------------------------
D. Tandem Repeats?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
zaabaabz
?????
code?????s
codeforces
Output
6
4
10
0
----------------------------------------------------------------------------------------------------
E. Clique Partition
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
2 3
5 4
8 16
Output
2 1
1
1 1
3 1 5 2 4
2
1 1 2 1 2
1 2 3 4 5 6 7 8
1
1 1 1 1 1 1 1 1
----------------------------------------------------------------------------------------------------
F. Rare Coins
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
1 0
0 2
2 2
1 1
Output
748683265 748683265 
Input
4 3
2 3 4 5
1 0 7 3
3 3
2 3
1 4
Output
997756929 273932289 1 
----------------------------------------------------------------------------------------------------
G. MST with Matching
time limit per test: 6 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4 10
0 1 8 0
1 0 1 0
8 1 0 2
0 0 2 0
Output
21
Input
4 5
0 1 8 0
1 0 1 0
8 1 0 2
0 0 2 0
Output
14
----------------------------------------------------------------------------------------------------
