Codeforces Round 604 (Div. 2)


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

Examples
Input
3
a???cb
a??bbc
a?b?c
Output
ababcb
-1
acbac
----------------------------------------------------------------------------------------------------
B. Beautiful Numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
6
4 5 1 3 2 6
5
5 3 1 2 4
4
1 4 3 2
Output
101011
11111
1001
----------------------------------------------------------------------------------------------------
C. Beautiful Regional Contest
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
12
5 4 4 3 2 2 1 1 1 1 1 1
4
4 3 2 1
1
1000000
20
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
32
64 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 16 16 16 11
Output
1 2 3
0 0 0
0 0 0
2 5 3
2 6 6
----------------------------------------------------------------------------------------------------
D. Beautiful Sequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 2 1
Output
YES
0 1 0 1 2 3 2
Input
1 2 3 4
Output
NO
Input
2 2 2 3
Output
NO
----------------------------------------------------------------------------------------------------
E. Beautiful Mirrors
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
50
Output
2
Input
3
10 20 50
Output
112
----------------------------------------------------------------------------------------------------
F. Beautiful Bracket Sequence (easy version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
??
Output
1
Input
(?(?))
Output
9
----------------------------------------------------------------------------------------------------
