libnguyen2's blog

By libnguyen2, history, 4 months ago, In English

A while ago I heard of a problem (roughly paraphrasing):

"Given a N x N board. There are M distinct weighted tiles on the board, the i-th tile has weight W[i]. In each game, you can select three rows/columns (3 rows/ 2 rows 1 columns/ 1 row 2 columns/ 3 columns). The score of a game is the sum of weight of all tiles that belongs to a selected row/column.

There are also Q queries with the form i W: Increasing the weight of the i-th tile by C (C is positive). The queries are impersistent.

For the initial board and each query, calculate the optimal score of the game corresponding to that board" Constrains: 1 <= N <= 10^9, 1 <= M <= 10^5, 1 <= W[i] <= 10^18, 1 <= C <= 10^18

The question seems very tricky to implement and a casework nightmare, and I can't find the original source for submission. I remembered that it was from TopCoder or something. Please help me find the source of this question.

  • Vote: I like it
  • 0
  • Vote: I do not like it