Subarray function

0

0 votes
Basic Programming
Problem

Note: This is an approximate problem. There is no exact solution. You must find the most optimal solution. Please, take a look at the sample explanation to ensure that you understand the problem correctly.

Problem statement

You are given an array A of N elements and two integers L and R

Choose an array B which is a permutation of array [1, 2, 3, …., N - 1, N] and build an array C as C[i] = A[B[i]].

The goal is to maximize the value of array function Z

Z=Ri=LRj=ijk=iC[k]k(i+j) ,  represents bitwise-xor operator.

Input

  • First line contains three space separated integers N L R.
  • Next line contains N space separated integers denoting the value array A

Output

  • Print N space separated integers denoting the array B

Constraints

1N1031LRN1A[i]104

Verdit and Scoring

  • is the score for each test case.
  • If the output is wrong or array B is not a correct permutation, then you will receive a Wrong Answer verdict.
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
  • C = [2 1 3 4 6 1]
  • Value of function is Z = 8.
Editor Image

?