Codeforces Round 145 (Div. 2, ACM-ICPC Rules)


A. Lefthanders and Righthanders
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
6
LLRLLL
Output
1 4
2 5
6 3
Input
4
RRLL
Output
3 1
4 2
----------------------------------------------------------------------------------------------------
B. Reading
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
5 3
20 10 30 40 10
Output
20
1 3 4 
Input
6 5
90 20 35 40 60 100
Output
35
1 3 4 5 6 
----------------------------------------------------------------------------------------------------
C. Weather
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
4
-1 1 -2 1
Output
1
Input
5
0 -1 1 2 -5
Output
2
----------------------------------------------------------------------------------------------------
D. Cinema
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
5 3
1 2 3
6
firstfilm
3
0 0 0
secondfilm
4
0 0 4 5
thirdfilm
1
2
fourthfilm
1
5
fifthfilm
1
4
sixthfilm
2
1 0
Output
2
2
1
1
1
2
Input
5 3
1 3 5
4
jumanji
3
0 0 0
theeagle
5
1 2 3 4 0
matrix
3
2 4 0
sourcecode
2
2 4
Output
2
0
1
1
----------------------------------------------------------------------------------------------------
E. Champions' League
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
8
1 3 1 7
Barcelona 158
Milan 90
Spartak 46
Anderlecht 48
Celtic 32
Benfica 87
Zenit 79
Malaga 16
Output
Group A:
Barcelona
Benfica
Spartak
Celtic
Group B:
Milan
Zenit
Anderlecht
Malaga
----------------------------------------------------------------------------------------------------
F. Fence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
4
5 7
3 3 4 1
Output
3
Input
3
2 3
1 3 1
Output
2
Input
3
3 3
2 2 2
Output
-1
----------------------------------------------------------------------------------------------------
G. Practice
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
2
Output
1
1 1
Input
3
Output
2
2 1 2
1 1
----------------------------------------------------------------------------------------------------
H. Merging Two Decks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

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