CF863G.Graphic Settings

NOI/NOI+/CTSC

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Recently Ivan bought a new computer. Excited, he unpacked it and installed his favourite game. With his old computer Ivan had to choose the worst possible graphic settings (because otherwise the framerate would be really low), but now he wants to check, maybe his new computer can perform well even with the best possible graphics?

There are m graphics parameters in the game. i-th parameter can be set to any positive integer from 1 to a__i, and initially is set to b__i (b__i ≤ a__i). So there are different combinations of parameters. Ivan can increase or decrease any of these parameters by 1; after that the game will be restarted with new parameters (and Ivan will have the opportunity to check chosen combination of parameters).

Ivan wants to try all p possible combinations. Also he wants to return to the initial settings after trying all combinations, because he thinks that initial settings can be somehow best suited for his hardware. But Ivan doesn't really want to make a lot of restarts.

So he wants you to tell the following:

  • If there exists a way to make exactly p changes (each change either decreases or increases some parameter by 1) to try all possible combinations and return to initial combination, then Ivan wants to know this way.
  • Otherwise, if there exists a way to make exactly p - 1 changes to try all possible combinations (including the initial one), then Ivan wants to know this way.

Help Ivan by showing him the way to change parameters!

最近,伊万买了一台新电脑。他兴奋地拆开包装,并安装了自己最喜爱的游戏。用旧电脑时,伊万不得不选择最差的图形设置(否则帧率会非常低),但现在他想试试,也许新电脑即使启用最佳图形设置也能运行良好?

游戏中共有 mm 个图形参数。第 ii 个参数可设为 11 到 aia_i(含)之间的任意正整数,初始值为 bib_i(满足 bi≤aib_i \le a_i)。因此,总共有 种不同的参数组合。伊万每次可将任一参数增加或减少 11;随后游戏将重启并应用新的参数设置(伊万即可检验该参数组合)。

伊万希望尝试全部 pp 种可能的参数组合。此外,他还希望在尝试完所有组合后回到初始设置,因为他认为初始设置可能在某种程度上最契合他的硬件。但伊万并不想进行过多的重启操作。

因此,他希望你回答以下问题:

  • 若存在一种方式,恰好经过 pp 次调整(每次调整将某个参数增减 11),遍历全部可能的参数组合并最终回到初始组合,则请给出这种调整方式;
  • 否则,若存在一种方式,恰好经过 p−1p-1 次调整,遍历全部 pp 种参数组合(包括初始组合),则请给出这种调整方式。

请帮助伊万,向他展示参数调整的具体路径!

输入格式

The first line of input contains one integer number m (1 ≤ m ≤ 6).

The second line contains m integer numbers _a_1, _a_2, ..., a__m (2 ≤ a__i ≤ 1000). It is guaranteed that .

The third line contains m integer numbers _b_1, _b_2, ..., b__m (1 ≤ b__i ≤ a__i).

输入的第一行包含一个整数 $ m (( 1 \leq m \leq 6 $)。

第二行包含 $ m $ 个整数 $ a_1, a_2, \dots, a_m (( 2 \leq a_i \leq 1000 $)。保证满足 。

第三行包含 $ m $ 个整数 $ b_1, b_2, \dots, b_m (( 1 \leq b_i \leq a_i $)。

输出格式

If there is a way to make exactly p changes (each change either decreases or increases some parameter by 1) to try all possible combinations and return to initial combination, then output Cycle in the first line. Then p lines must follow, each desribing a change. The line must be either inc x (increase parameter x by 1) or dec x (decrease it).

Otherwise, if there is a way to make exactly p - 1 changes to try all possible combinations (including the initial one), then output Path in the first line. Then p - 1 lines must follow, each describing the change the same way as mentioned above.

Otherwise, output No.

如果存在一种方式,恰好进行 pp 次修改(每次修改将某个参数增加或减少 11),从而遍历所有可能的组合并最终回到初始组合,则在第一行输出 Cycle;随后必须输出 pp 行,每行描述一次修改,格式为 inc x(将参数 xx 增加 11)或 dec x(将参数 xx 减少 11)。

否则,如果存在一种方式,恰好进行 p−1p-1 次修改,从而遍历所有可能的组合(包括初始组合),则在第一行输出 Path;随后必须输出 p−1p-1 行,每行以同上方式描述一次修改。

否则,输出 No。

输入输出样例

  • 输入#1

    1
    3
    1

    输出#1

    Path
    inc 1
    inc 1
  • 输入#2

    1
    3
    2

    输出#2

    No
  • 输入#3

    2
    3 2
    1 1

    输出#3

    Cycle
    inc 1
    inc 1
    inc 2
    dec 1
    dec 1
    dec 2

输入解题思路,AI测评打分。不知道怎么写?

首页