Editorial for SAC '22 Code Challenge 4 P5 - Obligatory Interactive Problem
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
It suffices to count inversions by iterating over all pairs of indices (including
Time Complexity:
Query Count:
Subtask 2
Optimize the subtask
Time Complexity:
Query Count:
Subtask 3
This subtask was intended to reward solutions that use a heuristic that has a bad query constant.
Subtask 4
First, query
For the heights that were not found in the
After sorting it, output the permutation.
Time Complexity:
Query Count:
Note that other solutions that use probabilistic lemmas also suffice since the grader is not adaptive.
Comments