Editorial for BPC 1 S1 - Homework Questions
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
We can look at the smallest and largest values in the input and divide both by to get the original numbers.
Subtask 2
We can use the same strategy as in the first subtask to find the smallest and largest elements of the original array. We also know that if we sort the elements in the input, the second element will be the sum of the two smallest elements in the original array.
Subtask 3
The simplest way to solve the full problem is to note that the sum of every ordered pair is added to the list and that each original element is unique. This means that the sum of every pair of distinct numbers is added to the list twice. However, a pair which has the same number twice is only added to the list once. Therefore, we can consider only the numbers that appear an odd number of times in the input, and output each divided by .
Time Complexity: or
Comments