Codeforces Round 891 (Div. 3)


A. Array Coloring
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
8
1 2 4 3 2 3 5 4
2
4 7
3
3 9 8
2
1 7
5
5 4 3 2 1
4
4 3 4 5
2
50 48
Output
YES
NO
YES
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
B. Maximum Rounding
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
1
5
99
913
1980
20444
20445
60947
419860
40862016542130810467
Output
1
10
100
1000
2000
20444
21000
100000
420000
41000000000000000000
----------------------------------------------------------------------------------------------------
C. Assembly via Minimums
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
1 3 1
2
10
4
7 5 3 5 3 3
5
2 2 2 2 2 2 2 2 2 2
5
3 0 0 -2 0 -2 0 0 -2 -2
Output
1 3 3
10 10
7 5 3 12
2 2 2 2 2
0 -2 0 3 5
----------------------------------------------------------------------------------------------------
D. Strong Vertices
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4
3 1 2 4
4 3 2 1
5
1 2 4 1 2
5 2 3 3 1
2
1 2
2 1
3
0 2 1
1 3 2
3
5 7 4
-2 -3 -6
Output
1
4 
2
3 5 
1
2 
3
1 2 3 
2
2 3 
----------------------------------------------------------------------------------------------------
E. Power of Points
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 4 3
5
1 2 5 7 1
4
1 10 100 1000
Output
8 7 6
16 15 18 24 16
1111 1093 1093 2893
----------------------------------------------------------------------------------------------------
F. Sum and Product
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 3 2
4
3 2
5 6
3 1
5 5
4
1 1 1 1
1
2 1
6
1 4 -2 3 3 3
3
2 -8
-1 -2
7 12
Output
1 1 0 0 
6 
1 1 3 
----------------------------------------------------------------------------------------------------
G. Counting Graphs
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 5
1 2 4
4 5
1 2 2
2 3 4
3 4 3
5 6
1 2 3
1 3 2
3 4 6
3 5 1
10 200
1 2 3
2 3 33
3 4 200
1 5 132
5 6 1
5 7 29
7 8 187
7 9 20
7 10 4
Output
1
8
80
650867886
----------------------------------------------------------------------------------------------------
