Блог пользователя Electro_Valkyrie

Автор Electro_Valkyrie, 10 месяцев назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор Electro_Valkyrie, история, 14 месяцев назад, По-английски

Please share your thoughts

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится