|
|||
SpiralingUnfortunately, even though you tried everything to defend against the hacking attack, they were able to access our network and unleash a horde of AI bots towards our routers, switches and servers. Their aim is to disrupt the contest! Luckily these bots are very basic and only work based on a rewarding system, so they just move round and round and if they find a server of lower value than the previous one they simply stop. Your task is to decide if a given robot is able to reach the most valuable server or not. InputThe input is an n x n matrix based on the following:
Output
The output is the integer 1 if starting to the
right from the
middle element of the given M matrix (so the element
az place M[(n-1)/2][(n-1)/2]) and moving towards the M[0][0] element
spirally counter-clockwise every element (including M[0][0] is greater-equal than the
previous one. Example
Input:
Explanation
In the first case our starting number is 13 and since start to the
right, our next element is 14. Since we move counter-clockwise as a
spiral, then we get the following sequence up until the [0][0]
element: |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |