luogu#P12196. [NOISG 2025 Prelim] Lasers 2

[NOISG 2025 Prelim] Lasers 2

3 10 10
2 5 9
1 3 1
4 7 10
6
10 10 50
8 8 0
3 3 0
6 6 2
7 7 9
1 1 50
5 5 21
6 6 4
10 10 4
10 10 3
10 10 3
9
4 17 0
2 4 1000000000
6 9 1000000000
8 13 1000000000
15 16 1000000000
4

提示

Subtasks

For all testcases, the input will satisfy the following bounds:

  • 1h,w20001 \leq h, w \leq 2000
  • 0k1090 \leq k \leq 10^9
  • 1l[i]r[i]w1 \leq l[i] \leq r[i] \leq w for all 1ih1 \leq i \leq h
  • 0c[i]1090 \leq c[i] \leq 10^9 for all 1ih1 \leq i \leq h

Your program will be tested on input instances that satisfy the following restrictions:

Subtask Marks Additional constraints
00 Sample test cases
11 66 k=0,c[i]=109k = 0, c[i] = 10^9
22 99 l[i]=r[i]l[i] = r[i]
33 1010 h,w18h, w \leq 18
44 77 h,w100,k2000h, w \leq 100, k \leq 2000
55 1515 h,w100h, w \leq 100
66 2323 h,w500h, w \leq 500
77 88 r[1]l[1]=r[2]l[2]==r[h]l[h]r[1] − l[1] = r[2] − l[2] = \ldots = r[h] − l[h]
88 2222 No additional constraints

Sample Test Case 1 Explanation

This test case is valid for subtasks 3,4,5,63, 4, 5, 6, and 88.

The laser toy in the above figure corresponds to this test case. Pavement can unlock the first and second sliding walls for a total cost of 9+1=109 + 1 = 10 dollars. He can then slide the first sliding wall such that it spans columns 44 to 77, and slide the second sliding wall to span columns 55 to 77.

This leaves 66 lasers (in columns 1,2,3,8,91, 2, 3, 8, 9, and 1010) unblocked, which is the maximum possible.

Sample Test Case 2 Explanation

This test case is valid for subtasks 22 to 88.

Sample Test Case 3 Explanation

This test case is valid for subtasks 1,3,4,5,61, 3, 4, 5, 6, and 88.