Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktoparrays · dynamic-programming · maximum-subarray
The organizer’s problem statement is available at the official source link.
segment with drops
Maximize a contiguous test segment with up to K drops
Choose one contiguous segment of test marks and discard at most K entries inside it; maximize the sum of the remaining marks.
| Segment | Dropped tests | Score |
|---|---|---|
| [l,r] | at most K | sum of retained marks |
| all segments | choose best | maximum segment score |
- 1
Choose a segment
The retained tests come from one contiguous range of the original sequence. - 2
Drop at most K marks
Within that range, discard up to K test marks before summing. - 3
Maximize the score
Find the segment and drops producing the largest retained total.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.