Manthan 2011


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

Examples
Input
5
LRLR
Output
2 1 2 1 2
Input
5
=RRR
Output
1 1 2 3 4
----------------------------------------------------------------------------------------------------
B. Restoration of the Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
1 1 1 1
youshouldnot
thoushaltnot
Output
5
Input
2 4 10 3
ab
ba
Output
3
Input
1 10 20 30
a
za
Output
1
----------------------------------------------------------------------------------------------------
D. Optical Experiment
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 4 5 2 3
3 4 2 1 5
Output
3
Input
3
3 1 2
2 3 1
Output
2
----------------------------------------------------------------------------------------------------
E. Save the City!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4 8
8 8
9 4
4 0
0 4
Output
5
Input
5
4 8
5 8
5 4
7 4
2 2
Output
0
----------------------------------------------------------------------------------------------------
