Banana Bunches Solution Kickstart
You are given two integers, the number of vertices simple polygon of vertices such that the area of the polygon is exactly , and all the vertices have non-negative integer coordinates with value up to .and area . You need to construct a
A simple polygon is one that:
- Defines a closed area.
- Does not have self-intersections, even at a single point.
- No two consecutive edges form a straight angle.
Input Banana Bunches Solution Kickstart
The first line of the input gives the number of test cases,. lines follow. The first line of each test case contains two integers, denoting the number of vertices and , denoting double the required area of the polygon.
Output Banana Bunches Solution Kickstart
For each test case, output one line containing
Case #, where : is the test case number (starting from 1) and is
IMPOSSIBLE if it is not possible to construct a polygon with the given requirements and
If you output
POSSIBLE, output more lines with integers each. The -th line should contain two integers and which denote the coordinates of the -th vertex. For each , the coordinates should satisfy the constraints. Vertices of the polygon should be listed in consecutive order ( should be adjacent to and in the polygon).
If there are multiple possible solutions, you can output any of them.
Limits Banana Bunches Solution Kickstart
Memory limit: 1 GB.
Test Set 1
Time limit: 20 seconds.
Test Set 2
Time limit: 40 seconds.
Sample Banana Bunches Solution Kickstart
2 4 36 5 2
Case #1: POSSIBLE 2 5 6 5 8 2 0 2 Case #2: IMPOSSIBLE
In Sample Case #1, we can output the above quadrilateral with coordinates, , and . The area of this quadrilateral is equal to .
In Sample Case #2, there is no way to construct a polygon withvertices and area equal to .