Codeforces Round 897 (Div. 2)


A. green_gold_dog, array and permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
100000
2
1 1
3
10 3 3
Output
1 
2 1 
1 3 2 
----------------------------------------------------------------------------------------------------
B. XOR Palindromes
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
6
101011
5
00000
9
100100011
3
100
1
1
Output
0010100
111111
0011111100
0110
11
----------------------------------------------------------------------------------------------------
C. Salyg1n and the MEX Game
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5
1 2 3 5 7
7
5
-1
3
0 1 2
0
-1
3
5 7 57
-1
Output
8
57
0
3
0
0
----------------------------------------------------------------------------------------------------
D. Cyclic Operations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
5 3
2 3 5 3 4
4 2
2 4 3 1
1 1
1
3 1
1 2 3
5 3
5 4 3 2 1
6 1
1 2 3 1 5 6
Output
YES
NO
YES
YES
NO
NO
----------------------------------------------------------------------------------------------------
E1. Salyg1n and Array (simple version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 2
6
4
6 6
4
Output
? 1
? 3
! 2
? 1
! 4
----------------------------------------------------------------------------------------------------
E2. Salyg1n and Array (hard version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 2
6
4
6 6
4
Output
? 1
? 3
! 2
? 1
! 4
----------------------------------------------------------------------------------------------------
F. Most Different Tree
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2
Output
1 2
Input
3
1 2
1 3
Output
1 2
2 3
Input
4
1 2
1 3
3 4
Output
1 2
2 3
3 4
----------------------------------------------------------------------------------------------------
