img
Czech ACM Student Chapter
Czech Technical University in Prague
Charles University in Prague
Technical University of Ostrava
acm
ˇ a
Slovak University of Technology
Pavol Jozef Saf´rik University in Koˇice
s
cz
ˇ
University of Zilina
Masaryk University
Matej Bel University in Bansk´ Bystrica
a
University of West Bohemia
CTU Open Contest 2011
Nine Invaders from Outer Space
It is 2091. After many years, the SETI@home project finally brings some results. Unfortunately,
these results are not quite exactly what the authors expected. The creatures from space turned
out to be hostile aliens. The Earth faces a danger of their invasion. Would you help to save the
human race? We need a couple of programs to make the fight easier.
Your programs can be written in C, C++, Pascal, or Java programming languages. The choice
is yours but you will be fully responsible for the correctness and efficiency of your solutions. We
need the correct answer produced in some appropriate time. Nothing else matters. You may
choose any algorithm and any programming style.
All programs will read one single text file from the standard input. The results will be written
to the standard output. Input and output formats are described in problem statements and
must be strictly followed. Each text line (including the last one) should be always terminated
by a newline character ("\n"), which is not considered to be a part of that line.
You are not allowed to use any other files, communicate over network, or create processes.
A small advice: If not specified otherwise, all input numbers and output results will fit into
a signed 32-bit integer type. Note however, that some intermediate results may exceed 231, even
if it sometimes may not be obvious.
Good luck in the Czech Technical University Open Contest 2011!
And remember, the future is in your hands!
This problem set consists of 11 sheets of paper (including this one) and contains nine problems.
Please make sure that you have the complete set.