ΠΔΠ-18 (2006) - Phase A (acropolis)

View as PDF

Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Java, Pascal, Python

ACROPOLIS

The Acropolis of Athens is, if not the most important, one of the most important creations of humanity. The construction of the Acropolis, from conception, design, study, construction, and the creation of its eternal sculptures, reveals the greatness of Greek civilization.

One of the many problems that the Ancient Greeks had to face was the elevation of the marbles on the sacred rock. To achieve this, they used a system with pulleys, so that when an empty cart descended, it was used as a counterweight for the ascending one. For the better achievement of this purpose, it was preferable for the lighter carts to ascend first.

However, during the creation of the sculptures of the Parthenon's facade, some separate pieces of Pentelic marble had to be transported directly and in a specific order. These pieces were small and practically of low weight (indicative weight 1).

Your task is to create a program that will help our ancestors plan the sequence of transporting the loads. The weights with the indicative value 1 correspond to these separate pieces of marble that need to be transported in the given order of appearance.

Input Files:

The input files named acropolis.in are text files with the following structure: The first line contains an integer N, where 1 < N < 1.000, which represents the number of loads to be transported. The next N lines (2, 3, ..., N + 1) contain the weights of the loads, expressed as an integer B, where 1 \le B \le 9.000. Loads with B = 1 must be transported in the order of appearance.

Output Files:

The output files named acropolis.out are text files with the following structure: They have exactly N lines, where each line contains a weight value B, and the order of appearance of the weights in the lines indicates the order of their transportation.

Examples of Input - Output Files:
1ο

STDIN (acropolis.in)

10
1740
532
9000
1
8500
4000
5000
2120
777
8999

STDOUT (acropolis.out)

532
777
1740
1
2120
4000
5000
8500
8999
9000
2ο

STDIN (acropolis.in)

9
7791
1
1
1
1
1
1
1
614

STDOUT (acropolis.out)

614
1
1
1
1
1
1
1
7791

Εxecution time < 1sec.


Comments

There are no comments at the moment.