Problems with sign 'I'
Deadline expired on 10 November 2015.
I. 382. ZUMA is a shooting game played on various boards. During the game the player should eliminate balls\(\displaystyle -\)having different colors and rolling along a line initially in one block\(\displaystyle -\)before any of the balls reach the edge of the board by shooting other balls at them. Create your program to simulate the game: the balls should roll along a straight line from left to right, and a shot is fired in each time unit. The detailed rules are as follows:
\(\displaystyle \bullet\) initially all balls are located on the left of the board with no gaps between them;
\(\displaystyle \bullet\) the first ball from the left is shifted to the right by one unit in each time unit;
\(\displaystyle \bullet\) each ball is shifted whose neighbor has been shifted;
\(\displaystyle \bullet\) a missile ball shot at the other balls reaches its destination after the shift described above took place, but still in the same time unit
\(\displaystyle \circ\) if there is a ball at the impact position, then
\(\displaystyle *\) if there is a block of balls adjacent to the impact position and having the same color as the missile color, then
- they disappear, that is, their positions become empty;
- if there are altogether at least 3 balls of the same color on the two sides of this newly created gap, then they also disappear, and this is repeated recursively;
\(\displaystyle *\) otherwise the missile ball stays at the impact position, and the ball that was there is shifted to the right, and all balls to the right are shifted whose neighbor has been shifted;
\(\displaystyle \circ\) if there is no ball at the impact position, then
\(\displaystyle *\) if there is a ball in a neighboring position, then the missile ball stays at the impact position;
\(\displaystyle *\) otherwise the missile ball disappears from the impact position.
The first line of the input file contains the length of the board \(\displaystyle h\), the number of balls \(\displaystyle p\) rolling on the board, and the number of balls \(\displaystyle k\) shot during the game. The second line of the input contains \(\displaystyle p\) characters (from the set A, ..., F) denoting the ball colors on the board and starting from the left. Then each of the next \(\displaystyle k\) lines describes a ball--position pair: the first character denotes the missile ball color, and the second number is the impact position of this ball when it hits the board. The output shows the final state of the system after the last missile ball has been shot.
\(\displaystyle \bullet\) If all balls were eliminated by the shots, then the first line of the output should be 0, and the second output line should be the number of the shot which first achieved this.
\(\displaystyle \bullet\) If any of the balls reached the edge of the board, then the first output line should be -1, and the second output line should be the number of the shot after which this happened.
\(\displaystyle \bullet\) If there is at least one ball on the board but none of them reached the edge of the board, then the first output line should be 1, and the second output line should contain \(\displaystyle h\) characters denoting the ball colors still on the board from left to right, and with . denoting an empty position.
The following example shows 7 different and independent board positions, a shot, and the state of the board after this shot.
The first and second command-line arguments to your program are the names of the input and output files, respectively.
The source code of your program\(\displaystyle -\)with a short documentation also describing your solution and specifying the name of the developer environment to use for compiling the source\(\displaystyle -\)should be submitted in a compressed file i382.zip.
I. 383. Data about some mining regions with license from the Hungarian authorities are available in the files telek.txt, banya.txt and nyersanyag.txt. The files are tabulator-separated, UTF-8 encoded text files with the first lines containing the field names.
Create a new database i383. First import the above data files into this database by using their original names. Upon importing, you should set the appropriate data formats and keys; the tables should not have any new fields.
You should solve the following tasks. For each query, only the requested values should appear and no other data. Your solutions should be saved by using the names specified in the parentheses.
1. By using a query, list all settlements where they discontinued underground mining. A settlement name cannot appear more than once in your list. (3bezart)
2. Which mining site has the thickest layer of coal? Display the settlement name and the layer thickness. (4sokszen)
3. For each rock mine determine, by using a query, what other raw materials are or were extracted. The list should not contain ``rock'' itself. (5kavics)
4. Determine the active mines in which there is extractable raw material between 400 and 500 meters above sea level. The list should contain the settlement of the mine and the name of the raw material. (6magas)
5. Various hydrocarbons\(\displaystyle -\)even in different state-of-matter forms\(\displaystyle -\)are likely to occur together. By using a query, list the settlement names where both oil and natural gas are extracted. The list should contain the settlement names and the number of mining sites with the above property. (7szenhidrogen)
6. To maintain the database, one needs to have data on the elevation of the top and bottom layers of the raw material. Create a report listing the sites with at least one missing piece of data. In the report you should highlight the settlement name, give the site identifiers for each mine, the name of the raw material extracted, and\(\displaystyle -\)if known\(\displaystyle -\)the elevation values for the topmost and bottommost layers. You should use a query or an auxiliary table to prepare the report. In your report, you should take into account the order of the fields, the title, and the way the field names are displayed in the sample. The format of your report can be different from that of the sample. (8hiany)
7. Surface mining or surface and underground mining can vastly change the landscape. By using a query determine the number of settlements having any of these mining methods. (9tajrombolas)
The database with a short documentation (together with the name and version number of the database application) should be submitted in a compressed file i383.zip. Downloadable files: nyersanyag.txt, banya.txt, telek.txt (banyak.zip).
I. 384. Create an application to create and manipulate simple graphs (that is, graphs without loops or multiple edges). Your program should be able to handle and edit graphs with at most 20 vertices, and the user should be able to save and read these from a text file.
Upon clicking on an empty area in edit mode, a new vertex should be drawn. If the user clicks on two vertices, then the first vertex and the second vertex should become connected with an (undirected) edge if there was no edge between them, or the edge should be removed if there was already one between them.
Right-clicking with the mouse should have an analogous meaning: drawing or deleting a directed edge. The user should be able to move vertices with a drag-and-drop operation. Your program should number the vertices starting from 1. A double-click on a vertex should delete that vertex. If a vertex is removed, then all its edges should also be removed, and the numbers of all larger vertices should be decreased by one. Hence in the graph with \(\displaystyle N\) vertices, the vertex numbers range from 1 to \(\displaystyle N\). Vertices should be displayed as simple disks, with the current vertex numbers inside the disk. Edges should be drawn as line segments, and directed edges should have arrows. Your program can ignore certain graphical issues, for example, it is not considered as a problem if a disk partially covers an edge of a different vertex, or if two disks representing two vertices overlap. We can assume that the user is experienced, and tries to create a nice graph layout. Upon pressing key M, or choosing Save from the menu, your program should save the graph data into a text file graf.txt. The first line of the file should contain the number of vertices \(\displaystyle N\) and edges \(\displaystyle E\), then the width and height of the drawing area, separated by a space. The following \(\displaystyle N\) lines contain the coordinates of the vertices obtained from the graphical input (pairs of integers separated by a space). The next \(\displaystyle E\) lines should contain the edge data (again, pairs of integers separated by a space). Upon pressing key B, or choosing Open from the menu, your program should erase the current working area and open the file graf.txt for further editing.
In your solution you can use any programming language or developer environment that appears on our ``Rules of the contest'' page. We also accept web applications running on the client side.
The source code of your program\(\displaystyle -\)together with a short documentation also describing your solution and specifying the developer environment to compile your code\(\displaystyle -\)should be submitted in a compressed file i384.zip.