QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#15831. Task scheduler

統計

一个简单的任务调度器为嵌入式系统调度任务。每个任务都有一个任务 ID、优先级值以及指向其对应回调函数的函数指针。任务 ID 由 0 到 99 之间的整数表示。优先级值由 0 到 255 之间的整数表示。回调函数负责打印关联的任务 ID。

任务由开发者静态添加。在添加了 $N$ 个任务后,任务调度器开始调度任务。优先级值最小的任务将首先被调度。如果多个任务具有相同的优先级值,则最先添加到系统中的任务将首先被调度。现在,让我们看看系统会打印什么。

输入格式

第一行包含一个整数 $T$,表示测试用例的数量。接下来的每个测试用例包含三行。

对于每个测试用例,第一行是一个整数 $N \le 100$,表示接下来两行整数的数量。第二行包含 $N$ 个整数,每个整数代表一个任务的 ID。第二行中越靠前的整数表示其对应的任务越早被添加到系统中。第三行也包含 $N$ 个整数,表示优先级值。第三行中的第 $i$ 个数字是第二行中第 $i$ 个数字所代表任务的优先级值。

输出格式

每个测试用例输出 $N$ 个整数,以空格分隔。这些整数是任务的 ID,其打印顺序对应于它们被调度的顺序。

数据范围

  • $1 \le T \le 10$
  • $1 \le N \le 100$
  • $0 \le taskID \le 99$
  • $0 \le priority\ value \le 255$

样例

输入 1

4
1
0
5
3
0 1 2
1 0 0
4
0 1 2 3
6 4 2 2
8
0 1 2 3 4 5 6 7
10 12 12 3 1 3 1 1

输出 1

0
1 2 0
2 3 1 0
4 6 7 3 5 0 1 2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.