Educational Codeforces Round 131 (Rated for Div. 2)


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

Examples
Input
3
0 0
0 0
1 0
0 1
1 1
1 1
Output
0
1
2
----------------------------------------------------------------------------------------------------
B. Permutation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2
3
Output
2
1 2
3
2 1 3
----------------------------------------------------------------------------------------------------
C. Schedule Management
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 4
1 2 1 2
2 4
1 1 1 1
5 5
5 1 3 2 4
1 1
1
Output
2
3
1
1
----------------------------------------------------------------------------------------------------
D. Permutation Restoration
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
0 2 0 1
2
1 1
5
0 0 1 4 1
3
0 1 3
Output
2 1 4 3 
1 2 
3 4 2 1 5 
3 2 1 
----------------------------------------------------------------------------------------------------
E. Text Editor
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
9 4
aaaaaaaaa
aaaa
7 3
abacaba
aaa
5 4
aabcd
abcd
4 2
abba
bb
6 4
baraka
baka
8 7
question
problem
Output
5
6
3
4
4
-1
----------------------------------------------------------------------------------------------------
F. Points
time limit per test: 6.5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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