[Solution] Rain Codeforces Solution | Solution Codeforces
You are the owner of a harvesting field which can be modeled as an infinite line, whose positions are identified by integers.
It will rain for the next days. On the -th day, the rain will be centered at position and it will have intensity . Due to these rains, some rainfall will accumulate; let be the amount of rainfall accumulated at integer position . Initially is , and it will increase by after the -th day's rain.
A flood will hit your field if, at any moment, there is a position with accumulated rainfall .
You can use a magical spell to erase exactly one day's rain, i.e., setting . For each from to , check whether in case of erasing the -th day's rain there is no flood.
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains two integers and (, ) — the number of rainy days and the maximal accumulated rainfall with no flood occurring.
Then lines follow. The -th of these lines contains two integers and () — the position and intensity of the -th day's rain.
The sum of over all test cases does not exceed .
For each test case, output a binary string length of . The -th character of is 1 if after erasing the -th day's rain there is no flood, while it is 0, if after erasing the -th day's rain the flood still happens.
No comments:
Post a Comment