#P15141. [SWERC 2025] Git Gud
[SWERC 2025] Git Gud
题目描述
You are an adventurer working for the futuristic corporation RoboCorp. Your initial skill level is an integer in the range , but you don't know its exact value. Your goal is to reach a skill level of at least by completing missions for RoboCorp, but each mission costs precious robocoins.
You can choose missions of any difficulty and any positive integer duration (in hours). However, the cost depends both on the new mission's length, and on how the new mission's difficulty compares to your most recent one.
Let be the difficulty of your most recent mission. If you want to undertake a new mission of difficulty and duration :
- If it is your first mission, or , the cost is robocoins.
- If , the cost is robocoins.
Your skill improves only when you take on a mission whose difficulty exactly matches your current skill :
- If , then your skill increases by .
- Otherwise, your skill does not change.
After each mission, you still don't know your actual skill value.
You start with robocoins. Find a strategy (a sequence of missions) that does not exceed your budget and guarantees your skill becomes at least , no matter what your initial skill was.
输入格式
The input contains a single line with an integer () — the target skill level (that is, by the end, your skill must be greater or equal to ).
输出格式
In the first line, print a single integer () — the number of missions you plan to complete.
Then, print lines. The -th line must contain two integers and () — the difficulty and duration (in hours) of the -th mission, respectively.
4
4
1 4
3 1
2 1
3 1
提示
Explanation of sample 1.
In the example, your target skill is . You can use the following strategy:
- Take a mission of difficulty and duration . It's your first mission, so you pay robocoins.
- Take a mission of difficulty and duration . The previous mission had difficulty , so since , you pay robocoins.
- Take a mission of difficulty and duration . Now , and since , you pay robocoin.
- Take a mission of difficulty and duration . Now , and since , you pay robocoins.
In total, you spend robocoins, which is within your -robocoin budget.
Now we verify that this strategy always works:
- If your initial skill was , after the first mission it becomes .
- If your initial skill was , after the third mission it becomes , and after the fourth mission it becomes .
- If your initial skill was , after the second mission it becomes .
- If your initial skill was , it stays .
So no matter what your starting skill is, you end with skill .