Codeforces Round 785 (Div. 2)


A. Subtle Substring Subtraction
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
aba
abc
cba
n
codeforces
Output
Alice 2
Alice 4
Alice 4
Bob 14
Alice 93
----------------------------------------------------------------------------------------------------
B. A Perfectly Balanced String?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
aba
abb
abc
aaaaa
abcba
Output
YES
NO
YES
YES
NO
----------------------------------------------------------------------------------------------------
C. Palindrome Basis
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
12
Output
7
74
----------------------------------------------------------------------------------------------------
D. Lost Arithmetic Progression
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
-3 1 7
-1 2 4
-9 3 11
0 6 3
2 5 5
7 5 4
2 2 11
10 5 3
0 2 9
2 4 3
-11 4 12
1 12 2
-27 4 7
-17 8 2
-8400 420 1000000000
0 4620 10
Output
0
10
-1
0
-1
21
0
273000
----------------------------------------------------------------------------------------------------
E. Power or XOR?
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 2
3 1 2
Output
1110
Input
3 1
3 1 2
Output
1010010
Input
3 0
3 1 2
Output
1000000000000000001010010
Input
2 1
1 1
Output
0
----------------------------------------------------------------------------------------------------
F. Anti-Theft Road Planning
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4
14
1
14
3
Output
1
8
2 4
1 2
1 1
1 2
2 1
----------------------------------------------------------------------------------------------------
