Codeforces Round 939 (Div. 2)


A. Nene's Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
2 1
3 5
5
5 3
2 4 6 7 9
1 3 5
5 4
3 4 5 6 7
1 2 3 4
2 3
69 96
1 10 100
1 1
100
50
3 3
10 20 30
1 10 100
Output
2 
1 1 1 
1 2 2 2 
1 10 68 
50 
1 9 9 
----------------------------------------------------------------------------------------------------
B. Nene and the Card Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4
1 1 2 3
8
7 4 1 2 8 8 5 5
8
7 1 4 5 3 4 2 6
3
1 2 3
1
1
Output
1
2
1
0
0
----------------------------------------------------------------------------------------------------
C. Nene's Magical Matrix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1
2
Output
1 1
1 1 1
7 3
1 1 1 2
1 2 1 2
2 1 1 2
----------------------------------------------------------------------------------------------------
D. Nene and the Mex Operator
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0 1
Output
4 1
1 2
Input
3
1 3 9
Output
13 0
Input
4
1 100 2 1
Output
105 2
3 3
3 4
Input
1
0
Output
1 1
1 1
----------------------------------------------------------------------------------------------------
E1. Nene vs. Monsters (Easy Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
2 5 3
2
0 0
4
1 5 7 2
4
4 2 1 2
13
1 1 4 5 1 4 1 9 1 9 8 1 0
Output
1
1 
0
1
1 
2
1 3 
6
1 3 6 8 10 12 
----------------------------------------------------------------------------------------------------
E2. Nene vs. Monsters (Hard Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
2 5 3
2
0 0
4
1 5 7 2
4
4 2 1 2
13
1 1 4 5 1 4 1 9 1 9 8 1 0
Output
1
1 
0
1
1 
2
1 3 
6
1 3 6 8 10 12 
----------------------------------------------------------------------------------------------------
F. Nene and the Passing Game
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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