AGM 2024 Qualification Round
A. AIstartup
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
3 2 10
1 3
1 2
2 1
1 2
Output
27

B. Artifacts
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5
1 2 1
1 3 1
1 4 1
5 2 1
2
2 4 2
3 1 2 3
Output
5
-1
Input
10
1 2 5
3 1 3
1 4 8
4 5 1
7 4 2
5 6 4
7 8 1
9 7 10
10 8 5
6
3 9 5 6
2 6 4
1 5
2 5 4
3 8 7 5
3 2 3 4
Output
65
60
53
61
-1
62

C. Bees and Flowers
time limit per test
1.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Examples
Input
2 2
1 7
2 10
7 8
10 10
Output
1
2
Input
10 5
21 10
28 25
25 7
6 25
30 12
23 20
2 12
17 14
18 15
13 21
20 4
7 1
11 2
1 5
27 3
Output
1
5
0
2
0
0
4
0
0
3
Input
3 2
1 7
2 10
18 10
7 8
10 10
Output
0
1
2

D. Bus
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

E. EraseSequence
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Examples
Input
5
4 3 1 5 2
Output
YES
3 5
4 3
4 2
1 4
Input
5
3 4 5 1 2
Output
NO

F. Financial Crisis
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
2 6
4
1 2
2 2
3 4
4 4
Output
0
Input
2 6
4
1 2
2 2
1 4
2 4
Output
1
Input
1 6
4
1 2
1 2
1 4
1 4
Output
4
Input
8 30
20
1 1
1 30
1 30
2 30
1 1
2 1
1 3
1 15
2 15
2 3
1 10
2 10
2 10
1 20
1 30
1 27
2 27
2 27
1 15
2 15
Output
17

G. Megadice
time limit per test
0.25 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
2
Output
6.66667

H. Piles Game
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
4 3
1 2 3
1 2 3
1 2 3
Output
13
1 4
2 4
3 4
1 3
1 2
3 1
3 1
2 3
2 1
2 3
4 2
4 2
4 2

I. Practice
time limit per test
1.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
4
able
tab
let
tablet
Output
tablet
Input
3
great
eat
rat
Output
NO SOLUTION

J. Ski Trip
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output
Example
Input
6 5
1 2 1 4 4
3 1 1
5 4 3
6 4 10
5 1 5
6 1 6
Output
10

K. Stop Orders
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
6 15 20
1 BUY 10
1 SELL 28
2 7 14
2 12 22
1 SELL 10
3
Output
1 2 
1 1 
-1 5

L. Easy Tetris
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
11 11
1 L 1 11 5
1 L_TRANSPOSED 1 11 5
2
1 RECTANGLE 2 10 10
2
1 U 1 10 2 4
1 HORIZONTAL_LINE 2 7
1 VERTICAL_LINE 5 5
1 CAMEL 1 3 5 7 9 11 3 5
1 MOUNTAIN 1 6 9 11 4 6
2
Output
2
6
13