Disks | Solution | Tests |
Consider N floating point numbers N representing the radii of N disks. We fix a disk in the xOy system, if we position it at a positive coordinate x (big enough), tangential to the 0x axis and above it and after that we push it to 0y until it becomes tangent to 0y or to the first disk that it meets on the way. In the configuration that results by fixing in order all the given disks, some of them can be considered as being dispensible, because, if we eliminate them, the total width of the configuration is the same, which means that there is no disk that can be moved to the left.
Task
Identify all the indispensible disks for a given configuration.
Input format
The input file DISCURI.IN has the following structure:
– the first line contains N, the number of disks;
– the next N lines contain N real numbers representing the radii of the disks, in the order they are fixed in the configuration.
Output format
The output file DISCURI.OUT will have the following structure:
Constraints
Example: (in the configuration from above; the gray disks are dispensible)
DISCURI.IN 7 4 0.1 0.5 3 0.5 4 1 |
DISCURI.OUT 3 2 3 5 |
Time limit: 1 second/test