#P3619. 魔法
魔法
Description
After cjwssb realized it was a misunderstanding, he apologized to you. To cheer him up, you plan to start doing magic together. However, your time is running out, and worse, you still need to complete magic tasks. Suppose your current time is . Each task has a constraint , meaning you can complete this task only when your is strictly greater than . Completing a task does not consume time. When you complete the -th task, your time increases by . At all times, must remain greater than . Determine whether you can complete all magic tasks. If yes, output ; otherwise, output .
Input Format
The first line contains an integer , the number of test cases.
For each test case:
- The first line contains two integers , meaning there are tasks and your initial time is .
- The next lines each contain two integers, and .
Output Format
For each test case, output or .
1
2 13
1 -9
5 -3
+1s
Hint
- For of the testdata, .
- For of the testdata, , , , , .
By lantian.
By ⚡炭治郎⚡.
Due to historical reasons, the blog discussion may not be able to post the sample output strings. You may consider other ways to work around this.
Translated by ChatGPT 5
京公网安备 11011102002149号