Task Scheduler

TimeLimit:1000MS  MemoryLimit:65536KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
ByteCompany has a server cluster with $m$ workers, $k$ of which are somehow disconnected.

The task scheduler have just received $n$ tasks, and the $i$-th task needs to be executed on $t_i$ workers.

For an executive order of $p_1 ,p_2 , \ldots p_n$, the task scheduler will assign workers for them respectively. Specifically, for the $i$-th task $p_i$, the scheduler will select $t_{p_i}$ workers randomly from all workers which hasn't been assigned tasks at this moment. Each of those free workers share a universal equal probability to be selected. Note that disconnected workers may also be selected. In this scenario, the current scheduling will be considered as a failure and retry automatically and immediately. Only when the scheduling of the current task is successful, the next task will be proceeded.

Now you need to find an optimal executive order of $p_1 ,p_2 , \ldots p_n$ to minimize the expected amount of the scheduling process. We guarantee that the amount of connected workers is enough to finish all scheduling.
Input
The input contains several test cases, and the first line contains a single integer $T$ ($1 \le T \le 100$), the number of test cases.

For each test case, the first line contains three integers $n$ ($1 \le n \le 100$), $m$ ($n \le m \le 10\,000$) and $k$ ($0 \le k \le m - n$): the number of tasks, the total number of workers and the number of disconnected workers.

The following line contains $n$ positive integers $t_1, t_2, t_3, \ldots, t_n$ ($n \le \sum_{i=1}^{n}t_i \le m - k$), describing the number of needed worker for each task.
Output
For each test case, output $n$ integers $p_1 ,p_2 , \ldots, p_n$ on a single line representing the order of tasks to be scheduled.

If there are multiple solutions, output the lexicographically smallest one.
SampleInput
2
2 4 1
1 2
3 3 0
1 1 1
SampleOutput
2 1
1 2 3
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: