Codeforces Round 617 (Div. 3)


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

Examples
Input
5
2
2 3
4
2 2 8 8
3
3 3 3
4
5 5 5 5
4
1 1 1 1
Output
YES
NO
YES
NO
NO
----------------------------------------------------------------------------------------------------
B. Food Buying
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1
10
19
9876
12345
1000000000
Output
1
11
21
10973
13716
1111111111
----------------------------------------------------------------------------------------------------
C. Yet Another Walking Robot
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
LRUD
4
LURD
5
RRUDU
5
LLDDR
Output
1 2
1 4
3 4
-1
----------------------------------------------------------------------------------------------------
D. Fight with Monsters
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2 3 3
7 10 50 12 1 8
Output
5
Input
1 1 100 99
100
Output
1
Input
7 4 2 1
1 3 5 4 2 7 6
Output
6
----------------------------------------------------------------------------------------------------
E1. String Coloring (easy version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
abacbecfd
Output
YES
001010101
Input
8
aaabbcbb
Output
YES
01011011
Input
7
abcdedc
Output
NO
Input
5
abcde
Output
YES
00000
----------------------------------------------------------------------------------------------------
E2. String Coloring (hard version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
abacbecfd
Output
2
1 1 2 1 2 1 2 1 2 
Input
8
aaabbcbb
Output
2
1 2 1 2 1 2 1 1
Input
7
abcdedc
Output
3
1 1 1 1 1 2 3 
Input
5
abcde
Output
1
1 1 1 1 1 
----------------------------------------------------------------------------------------------------
F. Berland Beauty
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
3 2
3 4
2
1 2 5
1 3 3
Output
5 3 5
Input
6
1 2
1 6
3 1
1 5
4 1
4
6 1 3
3 4 1
6 5 2
1 2 5
Output
5 3 1 2 1 
Input
6
1 2
1 6
3 1
1 5
4 1
4
6 1 1
3 4 3
6 5 3
1 2 4
Output
-1
----------------------------------------------------------------------------------------------------
