Advertisement
Guest User

rektprob

a guest
Jan 20th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. N robots take part in the marathon. Robots must overcome the same distance by moving along tracks one meter wide each.
  2. It is known that the robot located on the i-th track overcomes the distance in ai seconds.
  3. At the starting point of each robot, a special signaling device is installed, which should be activated at the time of launch. To make the competition less predictable, judges in front of
  4. Start can disable some signaling devices, other devices will remain active. Only active devices are triggered at the moment when the main judge starts
  5. marathon. At the beginning of the marathon, at least one signaling device must be active.
  6. Each robot starts moving at the moment when it reaches the starting signal from
  7. active device. The signal propagates at a speed of 1 meter per second. Distance between
  8. paths i and j is equal to | i - j | meters Denote as xi the distance from the i-th track to the nearest
  9. tracks containing the active device. The robot on the i-th track will start moving in xi seconds
  10. after the start, overcome the distance in ai seconds, and finish in fi = ai + xi seconds after
  11. start marathon.
  12. Let ki be the number of robots that finished strictly before the i-th robot. I-th place
  13. the robot at the end of the marathon is ki + 1. If several robots finish at the same time,
  14. and before them k robots finished, it is considered that they all took (k + 1) -th place.
  15. Consider an example. Let n = 3, robots overcome the distance for a1 = 2, a2 ​​= 3 and a3 = 5
  16. seconds, and only the signal device of the third robot was active. Then the first robot
  17. will start moving 2 seconds after the start of the race, f1 = 4. The second robot will start moving
  18. in 1 second, f2 = 4. The third robot will start moving at the moment of start, f3 = 5. By the end of the race
  19. The first and second robots share the first place, the third robot takes the third place. If, for example,
  20. all three signaling devices will work, robots finish in f1 = 2, f2 = 3, f3 = 5, seconds,
  21. respectively. The first robot will take the first place, the second robot will take the second place, and the third
  22. robot - the third place.
  23. As you can see from the example, the place that the robot will take depends on which signaling devices are active. It is necessary to process two types of requests:
  24. 1) for each robot to determine the minimum place that it can take;
  25. 2) for each robot to determine the maximum place that it can take.
  26. It is required to write a program that, by the type of request and information about the time of passage
  27. distance by each robot determines for each robot the minimum or maximum place,
  28. which he can take in a robo marathon.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement