Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

PizzaPasta's blog

By PizzaPasta, history, 7 months ago, In English

I met another problem (at the same forum) that has a tag of "data structures" but I can't seem to find a solution.

Given an array of n elements, divide into the minimum number of consecutive of subarrays that satifies the following conditions or determine if that is impossible:

  • Every element belongs to an exact subarray

  • The median of each subarray must be non-negative

  • Let array B be the array of the medians of the subarrays. The average of all elements of B must be be d (d is given)

  • Let array C be the array of the averages of each subarray. The median of C should be k (k is given)

  • B and C are both non-decreasing.

Please help. Thank you in advance!

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

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by PizzaPasta (previous revision, new revision, compare).