Thursday, October 9, 2014

ACM 1837. Isenbaev's Number / Число Исенбаева

 The constraints are small so we can go with a brute forces solution but it requires a lot of implementation. First of all I recommend using C++ . Initially all the names have a position of infinity. In the process of reading we need to find the team of the main character and mark all of his teammates with the number 2 (we will start numeration form 1 and 0 will be considered as undefined). Then n times, loop over the list and each time give each teammate a number if at least on of it's teammate has been defined, and update the number of every member if possible.


       FULL SOURCE CODE

No comments:

Post a Comment