Type: Default 1000ms 256MiB

周末舞会

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

假设在周末舞会上,男士们和女士们进入舞厅时,各自排成一队。跳舞开始时,依次从男队和女队的队头上各出一人配成舞伴。

规定每个舞曲能有一对跳舞者。若两队初始人数不相同,则较长的那一队中未配对者等待下一轮舞曲。现要求写一个程序,模拟上述舞伴配对问题。

Input

第一行两队的人数;

第二行舞曲的数目。

人数与舞曲的数目范围皆为:[1,100]

Output

配对情况

Samples

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

Limitation

1s, 1024KiB for each test case.

数据结构-栈与队列 树

Not Claimed
Status
Done
Problem
6
Open Since
2025-5-22 0:00
Deadline
2025-6-13 23:59
Extension
24 hour(s)