Codeforces Round 550 (Div. 3)


A. Diverse Strings
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
fced
xyz
r
dabcef
az
aa
bad
babc
Output
Yes
Yes
Yes
Yes
No
No
No
No
----------------------------------------------------------------------------------------------------
B. Parity Alternated Deletions
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 5 7 8 2
Output
0
Input
6
5 1 2 4 6 3
Output
0
Input
2
1000000 1000000
Output
1000000
----------------------------------------------------------------------------------------------------
C. Two Shuffled Sequences
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
7 2 7 3 3 1 4
Output
YES
2
3 7 
5
7 4 3 2 1 
Input
5
4 3 1 5 3
Output
YES
1
3 
4
5 4 3 1 
Input
5
1 1 2 1 2
Output
NO
Input
5
0 1 2 3 4
Output
YES
0
5
4 3 2 1 0 
----------------------------------------------------------------------------------------------------
D. Equalize Them All
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 4 6 6 6
Output
2
1 2 3 
1 1 2 
Input
3
2 8 10
Output
2
2 2 1 
2 3 2 
Input
4
1 1 1 1
Output
0
----------------------------------------------------------------------------------------------------
E. Median String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
az
bf
Output
bc
Input
5
afogk
asdji
Output
alvuw
Input
6
nijfvj
tvqhwp
Output
qoztvz
----------------------------------------------------------------------------------------------------
F. Graph Without Long Directed Paths
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 5
1 5
2 1
1 4
3 1
6 1
Output
YES
10100
----------------------------------------------------------------------------------------------------
G. Two Merged Sequences
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
5 1 3 6 8 2 9 0 10
Output
YES
1 0 0 0 0 1 0 1 0 
Input
5
1 2 4 0 2
Output
NO
----------------------------------------------------------------------------------------------------
