ผลต่างระหว่างรุ่นของ "01204212/statuses"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
แถว 21: | แถว 21: | ||
'''Output example''' | '''Output example''' | ||
− | For this input, the expected report would be (see the description of the output at the end): | + | For this input, the expected report would be (see the description of the output at the end of this task description): |
<pre> | <pre> | ||
แถว 34: | แถว 34: | ||
'''Test data:''' [http://theory.cpe.ku.ac.th/~jittat/courses/01204212/tasks/comments/ Download here] | '''Test data:''' [http://theory.cpe.ku.ac.th/~jittat/courses/01204212/tasks/comments/ Download here] | ||
+ | |||
+ | '''Output''' | ||
+ | |||
+ | The output contains ''n'' lines. Each line is a comment shown in the nested format (as in the example). Each line starts with a dash ("-") and is indented based on its comment level. (Comments of the status (i.e., those comments whose ''p''=0) are level 0, comments that reply on these level 0 comments are level 1, comments that reply on level 1 comments are level 2, and so on.) |
รุ่นแก้ไขเมื่อ 22:54, 17 สิงหาคม 2559
You are given an information on comments are posted. You want to print out a report on that in a nicely form.
Input
- First line: integer n (the number of comments)
- The next n lines, each line specify a comment. Line i + 1 for 1<=i<=n specifies the i-th comment. In this line, there is an integer p (p < i) and a string s (consiting of a - z and an underline (_) whose length is at most 30). This comment replies to the p-th comment. If p=0, this comment replies to the status itself. The string s 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 of this task description):
- 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
Test data: Download here
Output
The output contains n lines. Each line is a comment shown in the nested format (as in the example). Each line starts with a dash ("-") and is indented based on its comment level. (Comments of the status (i.e., those comments whose p=0) are level 0, comments that reply on these level 0 comments are level 1, comments that reply on level 1 comments are level 2, and so on.)