IMC Financial Markets OA 两个小时.
OA1:
There is a bot located at a pair of integer coordinates, (x,y). It must be moved to a location with another set of coordinates. Though the bot can move any number of times, it can only make the following three types of moves:
1. 1. From location (x,y) to location (x+y,y).
2. From location (x,y) to location (x,x+y).
3. For a specified positive constant c it can move from location (x,y) to location (x+c,y+c).
In addition, there are obstacles on the plane which prevent the bot from occupying certain cells. These cells cannot be included in the path. These obstacles exist at locations where the sum of the coordinates is a perfect square (i.e., the square root of the sum is an integer). For example, the (x,y) location
(2,7) is not allowed because 2+7=9 and 9=3∧2
For example, using c=1 and a starting position of (2,1), it might make the following sequence of moves: (2,1)→(3, 2)→(3,5). Note that movement will always be up, to the right, or both up and right. Given a positive constant c and starting and targe
int arrival[n]: an array of n integers where the value at index i is the time in seconds when the i-th car arrives at the intersection. If arrival[i] = arrival[j] and
i<j, then car i arrives before car j.
int street[n]: an array of n integers where the value at index i is the street on which the i-th car is traveling: 0 for Main Street and 1 for 1 st Avenue. Retuins:
int[n]: an array of n integers where the value at index i is the time when the i-th car will pass through the intersection.