AGM 2025, Final Round, Day 1
A. Ballistic Behaviour
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
2 2
0 5
8 -1
Output
L 1000000000000000006
R 200000000000000000
Input
20 3
19 3
94 7
106 -2
-3 -7
53 -9
126 -1
86 -10
146 2
-7 -10
-20 1
5 -6
15 -2
162 -4
22 -7
28 -8
-17 6
42 8
66 1
98 -4
152 6
Output
L 166666666666666669
R 999999999999999928
R 333333333333333318
L 125000000000000002
L 500000000000000046
R 166666666666666662
R 999999999999999984
R 166666666666666642
L 111111111111111115
L 99999999999999999
L 142857142857142858
L 142857142857142860
R 124999999999999991
L 250000000000000020
L 250000000000000033
L 100000000000000006
L 500000000000000014
L 1000000000000000111
R 499999999999999932
R 142857142857142842
Input
3 1
-2 2
0 1
3 -1
Output
L 1000000000000000001
R 1000000000000000000
R 500000000000000000

B. Move-a-coin-2
time limit per test
4 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output
Example
Input
3
R
D
L
U
Output
YES
4
R
D
L
R

C. Magic
time limit per test
6 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
Output
0 15 5
7 1 12
13 4 3

D. Beautiful Partition
time limit per test
5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
eyheo
dqpff
eniou
Output
5
8
2

E. Pencil
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
9
0 -4
0 4
4 4
-3 -3
-3 0
4 0
-2 -3
1 5
-2 -10
Output
10

F. Plane Seating Roulette
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
1
4 1
2
2
2
Output
1
Input
1
4 1
2
1
1
Output
2

G. Roundabout
time limit per test
3.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
22 26
7 16
8 19
3 9
4 21
6 2
19 22
2 17
16 21
21 13
22 10
7 10
4 5
9 14
5 15
14 20
17 11
13 18
10 1
2 13
12 22
11 12
15 7
20 8
10 4
18 3
1 6
Output
Yes

H. Rock-Paper-Level Up
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5 8
0 2 2 1 1
1 0 0 0 1
3 0
1 1 1
2 5
1 3 1
3 4
1 1 1
3 0
3 4
Output
3
13
7
13
Input
3 3
0 0 0
0 0 0
3 0
1 1 2
3 1
Output
3
3

I. Beautiful Sequence
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5 1
5 2 1 3 4
Output
2
Input
8 2
4 1 10 1 7 6 7 8
Output
5

J. Suffering from success
time limit per test
5 seconds
memory limit per test
6 megabytes
input
standard input
output
standard output

K. Textual Compliance
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
aaa
1
Output
3
Input
cbccbcacccacbca
3
Output
11
Input
abbaabba
2
Output
2

L. Texting
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output
Example
Input
aaba
Output
4