TopCoder

User's AC Ratio

100.0% (3/3)

Submission's AC Ratio

75.0% (3/4)

Tags

Description

Input Format

Output Format

Sample Input 1

2 1
2 2 3
6 2 4
4

Sample Output 1

10

Sample Input 2

3 1
2 3 5
3 3 2
7 3 6
5

Sample Output 2

25

Sample Input 3

5 4
1 100 7
5 8 5
10 1 4
21 3 2
53 10 6
11 19 63 64

Sample Output 3

35 16 20 7

Hints

Problem Source

YTP 2024 國中組程式挑戰營 p8

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~17 $M \leq 10$ 1
3 18~32 $r_i \leq 50, x_i, a_i \leq 10^ 6$ 4
4 0~47 無額外限制 15

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 262144 65536 1 2 4
1 1000 262144 65536 1 2 4
2 1000 262144 65536 1 2 4
3 1000 262144 65536 2 4
4 1000 262144 65536 2 4
5 1000 262144 65536 2 4
6 1000 262144 65536 2 4
7 1000 262144 65536 2 4
8 1000 262144 65536 2 4
9 1000 262144 65536 2 4
10 1000 262144 65536 2 4
11 1000 262144 65536 2 4
12 1000 262144 65536 2 4
13 1000 262144 65536 2 4
14 1000 262144 65536 2 4
15 1000 262144 65536 2 4
16 1000 262144 65536 2 4
17 1000 262144 65536 2 4
18 1000 262144 65536 3 4
19 1000 262144 65536 3 4
20 1000 262144 65536 3 4
21 1000 262144 65536 3 4
22 1000 262144 65536 3 4
23 1000 262144 65536 3 4
24 1000 262144 65536 3 4
25 1000 262144 65536 3 4
26 1000 262144 65536 3 4
27 1000 262144 65536 3 4
28 1000 262144 65536 3 4
29 1000 262144 65536 3 4
30 1000 262144 65536 3 4
31 1000 262144 65536 3 4
32 1000 262144 65536 3 4
33 1000 262144 65536 4
34 1000 262144 65536 4
35 1000 262144 65536 4
36 1000 262144 65536 4
37 1000 262144 65536 4
38 1000 262144 65536 4
39 1000 262144 65536 4
40 1000 262144 65536 4
41 1000 262144 65536 4
42 1000 262144 65536 4
43 1000 262144 65536 4
44 1000 262144 65536 4
45 1000 262144 65536 4
46 1000 262144 65536 4
47 1000 262144 65536 4