当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3447:Calendar of Events

Special Judge 特殊评判
题目描述
Marketing people are very creative and must regularly attend many creative meetings. In the past, the meetings used to repeat every week. Now, there are so many of them, that the period must have been changed to one month.

The monthly schedule of ACM now contains one meeting for each of the first N days in every month (including weekends). Meetings are identified by non-negative integer numbers. Recently, ACM found out that the schedule must be reorganized and the order of meetings changed. The new order has already been chosen. The only problem is that the meeting-planning department has very limited privileges and must follow many directives that are in effect.

It fact, the only change that the department is allowed to do, is to issue a request to reverse the order of meetings in the first D days of the month (D may be selected arbitrarily). For example, if the current schedule is “1 2 3 4 5” and the department issues a request to reverse the first 3 days, the new schedule will be “3 2 1 4 5”.

Another limitation is that the department is allowed to issue only one request per week. Since they need the whole reorganization to finish in one year, the number of requests may not exceed 52. As you can see, their situation is not easy. Will you help?
输入解释
The input contains a sequence of several reorganizations, the last one followed by a line with zero.

Each reorganization consists of three lines: the first line contains a positive integer N — the number of days in month that are considered, 1 ≤ N ≤ 30. The second line describes the old schedule and the third line the new schedule, each of them contains N meeting identifiers, separated with spaces. Some meetings may appear more than once.
输出解释
For each reorganization, output a single line containing at most 52 positive integer numbers D1, D2, ..., Dk separated by a space (1 ≤ Di ≤ N). The numbers must form a valid sequence of requests that will be issued to transform the old schedule to the new one.

You are guaranteed that such a sequence will exist. If there are more valid sequences, feel free
to output any of them.
输入样例
5
1 4 8 9 10
4 8 9 10 1
0
输出样例
5 4

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 CTU Open 2007

源链接: POJ-3447

最后修改于 2020-10-29T07:01:52+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 65536