Skip to content

2017. Grid Game #1191

Answered by mah-shamim
mah-shamim asked this question in Q&A
Jan 21, 2025 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

We'll use the following approach:

  1. Prefix Sum Calculation: We'll compute the prefix sums for both rows of the grid to efficiently calculate the sum of points for any subarray.

  2. Simulating Optimal Movement:

    • The first robot determines its path to minimize the points left for the second robot.
    • At each column transition, the first robot can choose to move down, splitting the grid into two segments:
      • Upper remaining points: Points in the top row after the transition column.
      • Lower remaining points: Points in the bottom row before the transition column.
  3. Minimizing the Maximum Points for the Second Robot:

    • At each transition, calculate the maximum points the second robot can collect after…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Jan 21, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Jan 21, 2025
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants