Codeforces Round 793 (Div. 2)


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

Examples
Input
3
3
aba
8
acaaaaca
2
dd
Output
1
4
2
----------------------------------------------------------------------------------------------------
B. AND Sorting
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
0 1 3 2
2
1 0
7
0 1 2 3 5 6 4
5
0 3 2 1 4
Output
2
0
4
1
----------------------------------------------------------------------------------------------------
C. LIS or Reverse LIS?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
6 6 6
6
2 5 4 5 2 4
4
1 3 2 2
Output
1
3
2
----------------------------------------------------------------------------------------------------
D. Circular Spanning Tree
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
0110
2
10
6
110110
Output
YES
2 1
3 4
1 4
NO
YES
2 3
1 2
5 6
6 2
3 4
----------------------------------------------------------------------------------------------------
E. Unordered Swaps
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
2 3 4 1
1 4
2 1
1 3
Output
2 3 1 
Input
6 4
6 5 1 3 2 4
3 1
2 5
6 3
6 4
Output
4 1 3 2 
----------------------------------------------------------------------------------------------------
F. MCMF?
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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