Company: Hitachi - Codility_14thjuly
Difficulty: easy
Can Points Meet n points sit in the plane and are numbered 1 to n in the order they are given. At time zero they all start moving at the same constant speed, and each one heads straight at the next point in the circular order: point 1 chases point 2 , point 2 chases point 3 , and point n chases point 1 . Every target is itself on the move, so each pursuer keeps re-aiming and its path bends into a curve. This is the classical cyclic pursuit of n pursuers. With equal speeds the chase always tightens: the whole group spirals inward and collapses onto one common location. The one situation in which nothing of the sort happens is a group of a single point — it has no one to chase but itself, so no pursuit takes place and the group never performs a meeting. For each of q independent groups, report whether the points of that group eventually meet at a single location. Input Format The first line contains an integer q , the number of queries. Each query is given as: - a line with an integer n