{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"hlce","formal_name":"Humanity's Last Code Exam","introduction":"Humanity's Last Code Exam evaluates problem solving and code generation using ICPC World Finals and IOI problems. The project describes 235 problems; this import selects its public ICPC dataset of 146 problems.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://humanity-s-last-code-exam.github.io/website/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"69cd0061-788f-53bd-a59b-cada447c6658","task_key":"ICPC~2dWorld~2dFinals--examples--2019~5fH","task_revision_id":"2","upstream_id":"2019_H","short_description":"Hobson’s Trains","config":"ICPC-World-Finals","split":"examples","body":"{\"platform\":\"atcoder\",\"question_content\":\"## Problem Statement\\n\\nMr. Hobson has retired from running a stable and has invested in a more modern form of transport, trains. He has built a rail network with \\\\( n \\\\) stations. However, he has retained his commitment to free the passenger from the burden of too many choices: from each station, a passenger can catch a train to exactly one other station. Such a journey is referred to as a leg. Note that this is a one-way journey, and it might not be possible to get back again.\\n\\nHobson also offers exactly one choice of ticket, which allows a passenger to travel up to \\\\( k \\\\) legs in one trip. At the exit from each station is an automated ticket reader (only one, so that passengers do not need to decide which to use). The reader checks that the distance from the initial station to the final station does not exceed \\\\( k \\\\) legs.\\n\\nEach ticket reader must be programmed with a list of valid starting stations, but the more memory this list needs, the more expensive the machine will be. Help Hobson by determining, for each station \\\\( A \\\\), the number of stations (including \\\\( A \\\\)) from which a customer can reach \\\\( A \\\\) in at most \\\\( k \\\\) legs.\\n\\n## Input\\n\\nThe first line of input contains two integers \\\\( n \\\\) and \\\\( k \\\\), where \\\\( n \\\\) ( \\\\( 2 \\\\leq n \\\\leq 5 \\\\cdot 10^5 \\\\) ) is the number of stations and \\\\( k \\\\) ( \\\\( 1 \\\\leq k \\\\leq n - 1 \\\\) ) is the maximum number of legs that may be traveled on a ticket. Then follow \\\\( n \\\\) lines, the \\\\( i \\\\)th of which contains an integer \\\\( d_i \\\\) ( \\\\( 1 \\\\leq d_i \\\\leq n \\\\) and \\\\( d_i \\\\neq i \\\\) ), the station which may be reached from station \\\\( i \\\\) in one leg.\\n\\n## Output\\n\\nOutput \\\\( n \\\\) lines, with the \\\\( i \\\\)th line containing the number of stations from which station \\\\( i \\\\) can be reached in at most \\\\( k \\\\) legs.\\n\\n## Sample Input 1\\n```\\n6 2\\n2\\n3\\n4\\n5\\n4\\n3\\n```\\n\\n## Sample Output 1\\n```\\n1\\n2\\n4\\n5\\n3\\n1\\n```\\n\\n## Sample Input 2\\n```\\n5 3\\n2\\n3\\n1\\n5\\n4\\n```\\n\\n## Sample Output 2\\n```\\n3\\n3\\n3\\n2\\n2\\n```\",\"question_title\":\"Hobson’s Trains\"}","display_format":"text","language":"","answer_status":"published","assets":[],"source_url":"https://humanity-s-last-code-exam.github.io/website/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}