Permutations on the Road: Bob
Time limit2sMemory limit1024 MB
Given up to N queries returning the inversion count within a subarray, reconstruct the hidden permutation of length N.
- Level
Hard8 of 10
- Topics
- Divide and conquer, Math, Combinatorics, Intervals
- Solved
- No attempts yet
Problem
Alice and Bob frequently take long road trips to get to various programming competitions in their area. Since everything is bigger in the state they live in, they have turned to playing car games to pass the time.
Alice and Bob are both computer scientists, so they quickly tired of "guess the number", since the guesser could always identify the number using a logarithmic number of guesses. To raise the challenge, they created a new game: "guess the permutation".
A permutation of length is an arrangement of the numbers . For a given permutation , define to be the number of pairs with such that .
When playing this game, Alice thinks of a permutation, and Bob can ask Alice the result of the function for up to inputs.
Can you help Bob figure out Alice's permutation ?