Codeforces Round 200 (Div. 2)


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

Examples
Input
6
10
10
10
01
10
10
Output
3
Input
4
01
01
10
10
Output
2
----------------------------------------------------------------------------------------------------
B. Simple Molecules
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 2
Output
0 1 1
Input
3 4 5
Output
1 3 2
Input
4 1 1
Output
Impossible
----------------------------------------------------------------------------------------------------
C. Rational Resistance
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
Output
1
Input
3 2
Output
3
Input
199 200
Output
200
----------------------------------------------------------------------------------------------------
D. Alternating Current
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
-++-
Output
Yes
Input
+-
Output
No
Input
++
Output
Yes
Input
-
Output
No
----------------------------------------------------------------------------------------------------
E. Read Time
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
2 5 6
1 3 6 8
Output
2
Input
3 3
1 2 3
1 2 3
Output
0
Input
1 2
165
142 200
Output
81
----------------------------------------------------------------------------------------------------
