Electro_Valkyrie's blog

By Electro_Valkyrie, 10 months ago, In English

You are given an array A of size N.

You must partition the array into one or more contiguous subarrays, with the following rules:

  1. Every element of A must belong to exactly one subarray.

  2. Each subarray must have length at least K.

The beauty of a subarray is defined as the maximum XOR value obtainable from any subset of the elements in that
subarray.

The amazingness of a partition is the sum of the beauties of all subarrays in the partition.

Your task is to determine the maximum possible amazingness of array A over all valid partitions.

Constraints : 1 <= N <= 100,000 , 1 <= K <= N , 1 <= $$$A_i$$$ <= 100,000

Any idea about how to solve this problem.

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By Electro_Valkyrie, history, 14 months ago, In English

Please share your thoughts

-- Some tips which can help to reduce the constant factor of string match using hashing.

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it