Nội dung Bài tập
Mã:
OLP19.Cau3.GreedyScheduler
Tên:
Cau3.Greedy Scheduler
Dạng thi:
oi
Thang điểm:
100 điểm
Giới hạn thời gian:
1 giây
Giới hạn bộ nhớ:
256 MB
Được tạo bởi:
thuthq
A store has n cashiers numbered sequentially from 1 to n, with c customers in a queue. A customer
at the front of the queue is constantly assigned to the first unoccupied cashier, i.e., cashier with the smallest number. The ith customer's shopping cart takes ti seconds to process.
Find which cashier will process each customer's shopping cart.

Input
The first line of input contains two space-separated integers n and c (1 <= n <= c <= 1000). The
second line of input contains c space-separated integers t1,..., tc, representing the length of time
required to handle that customer.

Output
Output a single line containing c space-separated integers, each with the cashier number that
handles that customer.

Sample Input and Output:

Input

Output

3 10

406 424 87 888 871 915 516 81 275 578

1 2 3 3 1 2 3 1 2 1






    Quảng cáo
       Ngôn ngữ : 

       Theme : 
Mời bạn soạn code



		



      Ai có thể xem bài này : 

Thông tin



Phần thảo luận