Codeforces Round 303 (Div. 2)


A. Toy Cars
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
-1 0 0
0 -1 1
0 2 -1
Output
2
1 3 
Input
4
-1 3 3 3
3 -1 3 3
3 3 -1 3
3 3 3 -1
Output
0
----------------------------------------------------------------------------------------------------
B. Equidistant String
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0001
1011
Output
0011
Input
000
111
Output
impossible
----------------------------------------------------------------------------------------------------
C. Woodcutters
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2
2 1
5 10
10 9
19 1
Output
3
Input
5
1 2
2 1
5 10
10 9
20 1
Output
4
----------------------------------------------------------------------------------------------------
D. Queue
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
15 2 1 5 3
Output
4
----------------------------------------------------------------------------------------------------
E. Paths and Trees
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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