Codeforces Round 868 (Div. 2)


A. A-characteristic
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
2 0
2 1
3 1
3 2
3 3
5 4
5 5
Output
YES
1 -1 
YES
1 1 
YES
1 -1 1 
NO
YES
1 1 1 
YES
-1 1 -1 1 1 
NO
----------------------------------------------------------------------------------------------------
B. Sort with Step
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
8
2
3 6
3
3 4 5
2
2 3
3
3 10 14
2
25 30
1
1080
9
3 3 3 5 5 5 7 7 7
20
12 15 2 2 2 2 2 3 3 3 17 21 21 21 30 6 6 33 31 39
Output
1
1
0
2
2
3
4
15
----------------------------------------------------------------------------------------------------
D. Unique Palindromes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
10 2
5 10
5 6
3 1
3
3
4 2
3 4
3 3
4 2
3 4
3 4
4 1
4
5
10 3
4 6 10
4 5 8
10 4
4 6 7 10
4 5 7 8
Output
YES
abcbbcabcb
YES
foo
YES
ayda
YES
wada
NO
YES
abcbcacbab
NO
----------------------------------------------------------------------------------------------------
E. Removing Graph
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2 3
1 2
2 3
3 1
4 5
5 6
6 4
Output
Bob
Input
6 1 2
1 2
2 3
3 1
4 5
5 6
6 4
Output
Bob
Input
12 1 3
1 2
2 3
3 1
4 5
5 6
6 7
7 4
8 9
9 10
10 11
11 12
12 8
Output
Alice
----------------------------------------------------------------------------------------------------
F. Random Walk
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1 3
1 2
2 3
Output
2 2 1 
Input
4 1 3
1 2
2 3
1 4
Output
4 2 1 2 
Input
8 2 6
6 4
6 2
5 4
3 1
2 3
7 4
8 2
Output
1 3 2 0 0 1 0 1 
----------------------------------------------------------------------------------------------------
