Quadratic Functions and a Line
Time limit0.1sMemory limit1024 MB
Given N quadratics with leading coefficient 1 or -1, pick the fewest that make every line meet at least one of them, and print their indices or -1.
Problem
Azber and Biou play a game on a two-dimensional coordinate plane.
Before the game starts, Azber has quadratic functions that Azber can draw. The leading coefficient of each quadratic function Azber has is either or .
At the beginning, Azber draws some of the quadratic functions on the coordinate plane.
If Biou can draw a line that meets none of the quadratic functions, Biou wins. If every line Biou draws meets at least one quadratic function, Azber wins.
If Azber can win, Azber wants to win by drawing the fewest possible quadratic functions on the coordinate plane.
Determine whether Azber can win. If Azber can, find the minimum number of quadratic functions that must be drawn on the coordinate plane, and find the quadratic functions Azber draws in that case.
Input
The first line contains the number of quadratic functions that Azber can draw.
The next lines each contain three integers , , and .
This means the -th quadratic function Azber has is .
Output
If Azber cannot win against Biou, print -1.
If Azber can win, print the minimum number of quadratic functions Azber uses on the first line. On the next line, print the numbers of the quadratic functions Azber uses, separated by spaces.
If several sets of the minimum size win, print any of them.