Technocup 2022 - Elimination Round 1


A. Windblume Ode
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
8 1 2
4
6 9 4 2
9
1 2 3 4 5 6 7 8 9
3
200 199 198
Output
2
2 1
4
2 1 4 3
9
6 9 1 2 3 4 5 7 8
3
1 2 3 
----------------------------------------------------------------------------------------------------
B. Omkar and Heavenly Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
7 4
1 2 3
3 4 5
5 6 7
6 5 4
5 3
1 2 3
2 3 4
3 4 5
Output
1 2
1 3
3 5
3 4
2 7
7 6
5 1
1 3
3 2
2 4
----------------------------------------------------------------------------------------------------
C. Omkar and Determination
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
..XXX
...X.
...X.
...X.
5
1 3
3 3
4 5
5 5
1 5
Output
YES
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
D. Omkar and the Meaning of Life
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2
0
1
Output
? 4 4 2 3 2
? 3 5 1 5 5
? 5 2 4 3 1
! 3 2 1 5 4
----------------------------------------------------------------------------------------------------
E. Moment of Bloom
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6 7
2 1
2 3
3 5
1 4
6 1
5 6
4 5
3
1 4
5 1
4 5
Output
YES
2
1 4
4
5 3 2 1
5
4 1 2 3 5
Input
5 7
4 3
4 5
2 1
1 4
1 3
3 5
3 2
4
4 2
3 5
5 1
4 5
Output
NO
2
----------------------------------------------------------------------------------------------------
F. Defender of Childhood Dreams
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 3
Output
2
1 2 2 2 2 2 2 1 1 1
Input
5 2
Output
3
3 2 2 1 2 2 1 3 1 1 
Input
8 7
Output
2
2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Input
3 2
Output
2
1 2 2 
----------------------------------------------------------------------------------------------------
G. Omkar and Time Travel
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 4
2 3
2
1 2
Output
3
Input
2
1 4
2 3
1
1
Output
2
Input
1
1 2
1
1
Output
1
Input
6
10 12
3 7
4 6
2 9
5 8
1 11
3
2 4 6
Output
17
Input
16
31 32
3 26
17 19
4 24
1 28
15 21
12 16
18 29
20 23
7 8
11 14
9 22
6 30
5 10
25 27
2 13
6
3 8 2 5 12 11
Output
138
----------------------------------------------------------------------------------------------------
H. Omkar and Tours
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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