Chapter 1: Programming Tasks
1.1 Nearby search
You are given a locations of players, monsters, and the radius. Each player only sees monsters within the specified radius. Output the total number of monsters seen by any players.
Input format:
- First line: (where is the number of players, is the number of monsters, and is a radius)
- The next lines, for each line the co-ordinate for each player:
- The next lines, for each line the co-ordinate for each monster:
Test data: Download here
Some answers:
n100.in
:5
n1000.in
:311
n5000.in
:7803
n10000.in
:31072
1.2 Status comments
You are given an information on how comments are posted. You want to display them in a nicely form.
Input
- First line: integer (the number of comments)
- The next lines, each line specify a comment. Line for specifies the -th comment. In this line, there is an integer () and a string (consiting of alphabets
a
-z
,A
-Z
, and an underline (_
) whose length is at most 30). This comment replies to the -th comment. If , this comment replies to the status itself. The string is the comment text.
Input example
7
0 hello_world
0 this_is_another_comment
1 first_reply
2 good_morning_thailand
1 second_one
1 third_one
5 when_it_is_ok
Output example
For this input, the expected report would be (see the description of the output at the end):
- 1 hello_world
- 3 first_reply
- 5 second_one
- 7 when_it_is_ok
- 6 third_one
- 2 this_is_another_comment
- 4 good_morning_thailand