Codeforces Round 843 (Div. 2)


A1. Gardener and the Capybaras (easy version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
bbba
aba
aaa
abba
abbb
Output
b bb a
a b a
a a a
ab b a
a bb b
----------------------------------------------------------------------------------------------------
A2. Gardener and the Capybaras (hard version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
bbba
aba
aaa
abba
abbb
Output
b bb a
a b a
a a a
ab b a
a bb b
----------------------------------------------------------------------------------------------------
B. Gardener and the Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
2 1 5
2 2 4
2 2 3
2
2 1 2
1 2
4
3 1 2 4
2 2 4
4 1 2 5 6
2 2 5
5
3 3 1 2
3 2 5 3
5 7 2 3 1 4
5 1 2 6 3 5
3 2 6 3
2
1 1
1 2
Output
No
Yes
Yes
Yes
No
----------------------------------------------------------------------------------------------------
C. Interesting Sequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
10 8
10 10
10 42
20 16
1000000000000000000 0
Output
12
10
-1
24
1152921504606846976
----------------------------------------------------------------------------------------------------
D. Friendly Spiders
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
2 14 9 6 8 15 11
5 6
Output
3
5 4 6 
Input
7
2 14 9 6 8 15 11
5 7
Output
-1
Input
7
2 14 9 6 8 15 11
5 5
Output
1
5
----------------------------------------------------------------------------------------------------
E. The Human Equation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
1 2 -3
5
1 0 0 -1 -1
6
2 -4 3 -5 4 1
5
1 -1 1 -1 1
7
0 0 0 0 0 0 0
Output
3
2
6
1
0
----------------------------------------------------------------------------------------------------
F. Laboratory on Pluto
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
1
2
7
Output
1 1
#
1 2
##
2 4
.###
####
Input
3 2
1000000007
1
2
7
Output
4 1
6 2
12 22
----------------------------------------------------------------------------------------------------
