Codeforces Round 808 (Div. 2)


A. Difference Operations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2
5 10
3
1 2 3
4
1 1 1 1
9
9 9 8 2 4 4 3 5 3
Output
YES
YES
YES
NO
----------------------------------------------------------------------------------------------------
B. Difference of GCDs
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5 1 5
9 1000 2000
10 30 35
1 1000000000 1000000000
Output
YES
1 2 3 4 5
YES
1145 1926 1440 1220 1230 1350 1001 1000 1233
NO
YES
1000000000
----------------------------------------------------------------------------------------------------
C. Doremy's IQ
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1
1
2 1
1 2
3 1
1 2 1
4 2
1 4 3 1
5 2
5 1 2 4 3
Output
1
11
110
1110
01111
----------------------------------------------------------------------------------------------------
D. Difference Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
1 10 100
4
4 8 9 13
5
0 0 0 8 13
6
2 4 8 16 32 64
7
0 0 0 0 0 0 0
Output
81
3
1
2
0
----------------------------------------------------------------------------------------------------
E. DFS Trees
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
1 2
3 5
1 3
3 2
4 2
Output
01111
Input
10 11
1 2
2 5
3 4
4 2
8 1
4 5
10 5
9 5
8 2
5 7
4 6
Output
0011111011
----------------------------------------------------------------------------------------------------
F. Partial Virtual Trees
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 998244353
1 2
2 3
1 4
Output
1 6 6 
Input
7 100000007
1 2
1 3
2 4
2 5
3 6
3 7
Output
1 47 340 854 880 320 
Input
8 1000000007
1 2
2 3
3 4
4 5
5 6
6 7
7 8
Output
1 126 1806 8400 16800 15120 5040 
----------------------------------------------------------------------------------------------------
