Dytechlab Cup 2022


A. Ela Sorting Books
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
12 3
cabccadabaac
12 6
cabccadabaac
12 12
cabccadabaac
25 1
abcdefghijklmnopqrstuvwxy
10 5
bcdxedbcfg
Output
edb
ccbbba
bbbbbaaaaaaa
z
aaaaa
----------------------------------------------------------------------------------------------------
B. Ela's Fitness and the Luxury Number
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
8 19
8 20
119 121
1 100000000000000000
1234567891011 1000000000000000000
Output
5
6
2
948683296
2996666667
----------------------------------------------------------------------------------------------------
C. Ela and Crickets
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
8
7 2 8 2 7 1
5 1
8
2 2 1 2 2 1
5 5
8
2 2 1 2 2 1
6 6
8
1 1 1 2 2 1
5 5
8
2 2 1 2 2 1
8 8
8
8 8 8 7 7 8
4 8
Output
YES
NO
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
D. Ela and the Wiring Wizard
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
8 9
1 2 3
6 4 5
3 5 6
6 1 3
7 4 4
3 8 4
2 3 3
7 8 5
4 5 2
4 5
1 2 1
2 4 1
3 4 1
3 1 1
1 3 2
8 8
4 6 92
7 1 65
6 5 43
6 7 96
4 3 74
4 8 54
7 4 99
2 5 22
Output
9
2
154
----------------------------------------------------------------------------------------------------
E. Ela Goes Hiking
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
5
2
Output
0
250000002
250000002
500000004
0
250000002
250000002
250000002
250000002
0
1
----------------------------------------------------------------------------------------------------
F. Ela and Prime GCD
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2
1 1
1
1
3
1 1 1
1
4
2
2 1
Output
0 1 
1 1 
1 0 
1 
0 1 1 
0 0 1 
1 0 1 
1 1 0 
0 1 0 
1 1 1 
1 0 0 
-1
2 0 
1 1 
0 1 
2 1 
1 0 
----------------------------------------------------------------------------------------------------
G. Ela Takes Dancing Class
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3 8
1 3 6 7
1011
1 1
1 2
1 3
1 4
2 1
2 2
2 3
2 4
Output
3
5
6
7
3
6
7
10
Input
1 1 5
2
1
1 1
2 1
3 1
4 1
5 1
Output
3
4
5
6
7
----------------------------------------------------------------------------------------------------
