Codeforces Round 208 (Div. 2)


A. Dima and Continuous Line
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 10 5 15
Output
yes
Input
4
0 15 5 10
Output
no
----------------------------------------------------------------------------------------------------
B. Dima and Text Messages
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
i
love
you
<3i<3love<23you<3
Output
yes
Input
7
i
am
not
main
in
the
family
<3i<>3am<3the<3<main<3in<3the<3><3family<3
Output
no
----------------------------------------------------------------------------------------------------
C. Dima and Containers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
0
1
0
1
2
0
1
2
3
0
Output
0
pushStack
1 popStack
pushStack
pushQueue
2 popStack popQueue
pushStack
pushQueue
pushFront
3 popStack popQueue popFront
Input
4
1
2
3
0
Output
pushStack
pushQueue
pushFront
3 popStack popQueue popFront
----------------------------------------------------------------------------------------------------
D. Dima and Hares
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 4
4 3 2 1
0 1 1 0
Output
13
Input
7
8 5 7 6 1 8 9
2 7 9 5 4 3 1
2 3 3 4 1 1 3
Output
44
Input
3
1 1 1
1 2 1
1 1 1
Output
4
----------------------------------------------------------------------------------------------------
E. Dima and Kicks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
1 1 1 1 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 1 1 1 1
Output
2 4
Input
7 7
0 0 1 1 1 0 0
0 0 1 0 1 0 0
1 1 1 1 1 1 1
1 0 1 0 1 0 1
1 1 1 1 1 1 1
0 0 1 0 1 0 0
0 0 1 1 1 0 0
Output
2
Input
3 3
1 1 1
1 1 1
1 1 1
Output
-1
Input
4 4
1 1 1 1
0 0 0 0
0 0 0 0
0 0 0 0
Output
3
Input
5 5
0 0 1 0 0
0 0 1 0 0
1 1 1 1 1
0 0 1 0 0
0 0 1 0 0
Output
-1
----------------------------------------------------------------------------------------------------
