Magyar Information Contest Journal Articles

Problem I. 310. (January 2013)

I. 310. In this task you are going to model floating ice floes. The corresponding data file jegesviz.txt can be downloaded from our website. The file contains an N×N grid with cells filled with V'' (=water) or J'' (=ice). All border cells contain water.

The first line of the file jegesviz.txt contains an integer (3N100), describing the number of rows (or columns) of the table. Then each of the following N lines contains N characters (either V'' or J'').

The first few lines of the file jegesviz.txt are displayed in the table.

Your program i310 should solve the following tasks. First, the number of the actual task (e.g. ,,Task #2'') should be displayed. Diacritical marks in the output may be omitted.

1. Read and store the data from jegesviz.txt.

2. By using the data from the file, compute and display (to 2 decimals) how many percent of the area is covered with ice.

3. Display which edge of the table is the closest one to the ice floes. If the answer is not unique, it is enough to give one of them. For example: The bottom edge is the closest one to the ice floes.

4. Nearby cells containing a J'' form an ice floe: a floe may consist of one or more J'' cells. If a floe has more than one J'', then at least one of the 4 neighbors of each J'' cell should also contain a J''. Display the number of ice floes.

5. Determine and display the number of J'' cells that are part of the largest ice floe.

6. Ice floes are melting in every time unit near their boundaries. A J'' cell is converted to a V'' cell, if at least 2 of its 4 side neighbors are already V'' cells. Display the number of time units after which there are no more floes present.

The source code (i310.pas, i310.cpp, ...) together with a short documentation (i310.txt, i310.pdf, ...) - also describing which developer environment to use for compiling, further a brief description of your solution - should be submitted.

Input example: jegesviz.txt

(10 pont)

Deadline expired on 11 February 2013.

Sorry, the solution is available only in Hungarian. Google translation

Mintamegoldás:

Fehér Balázs 10. évfolyamos tanuló (Budapest, Berzsenyi Dániel Gimnázium) programját mutatjuk be: i310.pas

Statistics:

 13 students sent a solution. 10 points: Csernák Tamás, Fehér Balázs, Fényes Balázs, Gema Barnabás, Jákli Aida Karolina, Komorowicz Dávid, Németh 017 András, Qian Lívia, Tegzes Tamás, Varga 256 Erik. 9 points: Forrás Bence, Kocsis 789 Mátyás. 5 points: 1 student.

 Our web pages are supported by: Morgan Stanley