Codeforces Round 915 (Div. 2)


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

Examples
Input
3
2 2
5 7
3 2
Output
2
7
3
----------------------------------------------------------------------------------------------------
B. Begginer's Zelda
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
1 2
1 3
3 4
9
3 1
3 5
3 2
5 6
6 7
7 8
7 9
6 4
7
1 2
1 3
2 4
4 5
3 6
2 7
6
1 2
1 3
1 4
4 5
2 6
Output
1
3
2
2
----------------------------------------------------------------------------------------------------
C. Largest Subsequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
5
aaabc
3
acb
3
bac
4
zbca
15
czddeneeeemigec
13
cdefmopqsvxzz
Output
0
1
-1
2
6
0
----------------------------------------------------------------------------------------------------
D. Cyclic MEX
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
6
5 4 3 2 1 0
3
2 1 0
8
2 3 6 7 0 1 4 5
1
0
Output
15
5
31
1
----------------------------------------------------------------------------------------------------
E. One-X
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
2
3
4
5
53278
Output
6
17
36
69
593324855
----------------------------------------------------------------------------------------------------
F. Field Should Not Be Empty
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5
1 2 3 4 5
5
2 1 3 4 5
7
2 1 5 3 7 6 4
6
2 3 5 4 1 6
7
7 6 5 4 3 2 1
Output
3
5
2
3
2
----------------------------------------------------------------------------------------------------
