z-trees
Memorial Drive is known to have a lot of trees along it. The street is made of concrete blocks, and some blocks have a hole in it from which a tree is growing. Also every block has a "Tree detector" that can detect the number of trees round (and at) that block.
Mister Little Z. had never been to memorial drive, but he found the data for all the detectors online.
For each of the N (1 <= N <= 400) blocks he know the power of the detector at that block Pi and the amount of trees the detector has detected Ci. Pi represents the maximal distance in blocks at which the detector detects a tree (if it equals 0, then the detector can only detect a tree on it's own block, and if it equals to one, then it can detect trees on previous block, its own block and the next block, you get the idea). Since every block can have at most one tree it will always be true that 0 <= Ci <= 2*Pi + 1, and Pi <= N
Your job is to help Little Z generate one possible tree arrangement so that the data he obtained from the internet "fits" correctly
Input:
3
1 1
1 1
1 1Output:
1
1Input:
3
2 1
1 1
2 1Output:
1
0Explanation: in this case we can have only one tree, but it can be located at any of the blocks 0 to N-1
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.