Ετήσια αρχεία: 2017


Blackgate Penitentiary

Vangelis the Batbear trapped all the members of Joker’s Streetgang in a basement.
Your job as a police officer is to transport all gang members to Blackgate Penitentiary.

To facilitate the transport, you should form a row such that the heights of the gang members are in non-decreasing order. For each gang member you should find the min and the max position where they can be in a valid sorted row and produce a roster with this information.

Input data

Input will start with a line that contains only one integer M, the number of crew members that were arrested. On each of the following M lines there will be a single word N and an integer H separated by a space character, where N is the name and H is the height of the crew member.

Output data

On the output, there will be G lines. Each line will contain in alphabetical order and space separated the names of the crew members that have the same height, followed by the min and the max position where any member of the specific group can be placed.

Limitations and notes

1 ≤ M ≤ 1000
1 ≤ length(N) ≤ 10
120 ≤ H ≤ 250

Names are only composed of characters of the Latin alphabet.


Create a graph out of an XML file

To create a graph out of an XML file, we used the yEd graph editor.
yEd is a desktop application that can be used to generate diagrams. It is free of charge (not FOSS) and runs on all major platforms: Windows, Unix/Linux, and Mac OS X.

For the following demo we used the latest release for GNU/Linux that was available at the time (yEd-3.17.1).

Usage Example

  1. Download yEd
  2. Extract it
  3. Navigate into the generated folder (e.g. if you used the attached version then the folder will be yed-3.17.1)
  4. Start the application using a JRE. In our case the command to start it was: java -jar yed.jar
  5. Click on the Open option (or go to File > Open... )
  6. Navigate to the XML file that you want to graph and click Open
  7. In the pop-up window for the drop-down named XSL File for then select the option XML-Tree and click Ok
  8. By now you should have your graph available to view/edit/export