SUPERCOMPUTER ARIS
The Ministry of Education announced that starting this year, the supercomputer ARIS installed in a dedicated space of the ministry is made available to the scientific and research community. During a -hour period, its computing power will be allocated to at most M research teams (numbered from to ), each of which will use it to run a data processing program.
To ensure fair distribution of computing power during the -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 -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 and M , separated by a space: the number of execution windows and the number of research groups. The second line contains exactly integers S, separated between them by a space (1 S , where 1 i N). The integer S is the number of the group whose program was executed in the -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.
- : the number of groups whose programs were executed during the hours . Note that can be less than if the programs of some groups are not executed at all during the hours.
- : the total number of execution windows for the program that was executed the fewest times .
- : the total number of execution windows for the program that was executed the most times .
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 groups were executed (with numbers , , , , ). The programs of groups and were given the least total time ( execution window each), while the program of group was given the most ( 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 groups were executed (with numbers , , , ). Note that the programs of groups and were not executed at all during the hours. The programs of groups and were given the least total time ( execution windows each), while those of groups and were given the most ( execution windows each).
Note: It has officially been included in the top most powerful supercomputers in the world, with processing power of teraflops ( floating-point operations per second) and a main memory capacity of Petabyte ( bytes). See http://hpc.grnet.gr.
Comments