Codeforces Round 598 (Div. 3)


A. Payment Without Change
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 4
1 2 3 6
5 2 6 27
3 3 5 18
Output
YES
NO
NO
YES
----------------------------------------------------------------------------------------------------
B. Minimize the Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
5 4 1 3 2
4
1 2 4 3
1
1
4
4 3 2 1
Output
1 5 2 4 3 
1 2 3 4 
1 
1 4 3 2 
----------------------------------------------------------------------------------------------------
C. Platforms Jumping
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 3 2
1 2 1
Output
YES
0 1 0 2 2 0 3 
Input
10 1 11
1
Output
YES
0 0 0 0 0 0 0 0 0 1 
Input
10 1 5
2
Output
YES
0 0 0 0 1 1 0 0 0 0 
----------------------------------------------------------------------------------------------------
D. Binary String Minimizing
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
8 5
11011010
7 9
1111100
7 11
1111100
Output
01011110
0101111
0011111
----------------------------------------------------------------------------------------------------
E. Yet Another Division Into Teams
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 3 4 2
Output
3 1
1 1 1 1 1 
Input
6
1 5 12 13 2 15
Output
7 2
2 2 1 1 2 1 
Input
10
1 2 5 129 185 581 1041 1909 1580 8150
Output
7486 3
3 3 3 2 2 2 2 1 1 1 
----------------------------------------------------------------------------------------------------
F. Equalizing Two Strings
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
abcd
abdc
5
ababa
baaba
4
asdf
asdg
4
abcd
badc
Output
NO
YES
NO
YES
----------------------------------------------------------------------------------------------------
