Educational Codeforces Round 105 (Rated for Div. 2)


A. ABC String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
AABBAC
CACA
BBBBAC
ABCA
Output
YES
YES
NO
NO
----------------------------------------------------------------------------------------------------
B. Berland Crossword
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
5
5 6
-1 1 5 11 15
-4 -3 -2 6 7 15
2 2
-1 1
-1000000000 1000000000
2 2
-1000000000 1000000000
-1 1
3 5
-1 1 2
-2 -1 1 2 5
2 1
1 2
10
Output
4
2
0
3
1
----------------------------------------------------------------------------------------------------
D. Dogeforces
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 5 7
5 1 7
7 7 4
Output
5
2 1 4 7 5 
4
1 5
2 5
5 4
3 4
----------------------------------------------------------------------------------------------------
E. A-Z Graph
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 11
+ 1 2 a
+ 2 3 b
+ 3 2 a
+ 2 1 b
? 3
? 2
- 2 1
- 3 2
+ 2 1 c
+ 3 2 d
? 5
Output
YES
NO
YES
----------------------------------------------------------------------------------------------------
F. Delete The Edges
time limit per test: 8 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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