ΠΔΠ-28 (2016) - Phase A (aris)

View as PDF

Submit solution

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

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

SUPERCOMPUTER ARIS

The Ministry of Education announced that starting this year, the supercomputer ARIS^1 installed in a dedicated space of the ministry is made available to the scientific and research community. During a 24-hour period, its computing power will be allocated to at most M research teams (numbered from 1 to M), each of which will use it to run a data processing program.

To ensure fair distribution of computing power during the 24-hour period, the program of each team can only run continuously for a short time, referred to as an "execution window." Then, the program execution is paused, if it has not completed, to be resumed at a later time after the programs of other teams have been executed. Each 24-hour period is divided into N execution windows of equal-duration, and the order in which the programs of the teams are executed is recorded in a daily log file.

Problem

Develop a program in one of the IOI languages (Pascal, C, C++, Java) that, after reading the program execution log file, will calculate:

  • the number of programs executed
  • the number of execution windows allocated to the program that required the least computing power, and
  • the number of execution windows allocated to the program that required the most computing power.
Input Files:

The input files with the name aris.in are text files with the following structure: They consist of exactly two lines. The first line contains two integers N (1 \le N \le 1.000.000) and M (1 \le M \le 1.000.000), separated by a space: the number of execution windows and the number of research groups. The second line contains exactly N integers S\mathbf{_i}, separated between them by a space (1 \le S\mathbf{_i} \le M, where 1 \le i \le N). The integer S\mathbf{_i} is the number of the group whose program was executed in the i-th execution window.

Output Files:

The output files with the name aris.out are text files with the following structure: They have exactly one line containing three integers K, X, Y, separated between them by a space.

  • K: the number of groups whose programs were executed during the 24 hours (K \le M). Note that K can be less than M if the programs of some groups are not executed at all during the 24 hours.
  • X: the total number of execution windows for the program that was executed the fewest times (X \le N).
  • Y: the total number of execution windows for the program that was executed the most times (Y \le N).
Examples of Input - Output Files:
1st

STDIN (aris.in)

10 5
1 2 3 4 1 5 1 5 2 1

STDOUT (aris.out)

5 1 4

Explanation: The programs of a total of 5 groups were executed (with numbers 1, 2, 3, 4, 5). The programs of groups 3 and 4 were given the least total time (1 execution window each), while the program of group 1 was given the most (4 execution windows).

2nd

STDIN (aris.in)

12 6
3 5 5 1 2 3 1 5 3 5 3 2

STDOUT (aris.out)

4 2 4

Explanation: The programs of a total of 4 groups were executed (with numbers 1, 2, 3, 5). Note that the programs of groups 4 and 6 were not executed at all during the 24 hours. The programs of groups 1 and 2 were given the least total time (2 execution windows each), while those of groups 3 and 5 were given the most (4 execution windows each).


Note: It has officially been included in the top 500 most powerful supercomputers in the world, with processing power of 180 teraflops (180 \times 10^{12} floating-point operations per second) and a main memory capacity of 1 Petabyte (1 \times 2^{50} bytes). See http://hpc.grnet.gr.


Comments

There are no comments at the moment.