A11217 | Graphic Settings
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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!
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!
输入格式
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}$ ).
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}$ ).
输出格式
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.
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.
输入输出样例
输入 #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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted