← 返回 amazon 的题目列表Load Balancer Server Selection by Job Index and Load
类型:online_judge
amazon
Problem 1: Load Balancer Design
You need to design a load balancer with n servers and m jobs. Each job comes with an index number. When selecting a server each time, you must meet the following conditions:
The server index should not be greater than the job's corresponding index.
Among the eligible servers, select the server with the smallest load. In case of a tie, choose the server with the smaller index.
The task is to return the sequence of server IDs used.
Example
Input
3
5
0 1 2 1 0