Board Game

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Danilo loves board games. Every weekend he meets his friends to play. However, after years of playing the same classic board games, he grew tired of them and hence decided to create his own game.

Danilo’s game starts with TT tokens on the board, which can be seen as points in the two-dimensional plane. There are PP players that take a single turn each. In their turn, each player picks a card from a deck. The card describes a straight line, and the player gets all the tokens located strictly below this line. Tokens received by a player do not return to the board. Note that a token located at (X,Y)(X, Y) is strictly below a line y=Ax+By = Ax + B if and only if Y<AX+BY < AX + B.

Given the list of cards, your task is to find which tokens each player receives.

입력

The first line contains an integer TT (1T1051 ≤ T ≤ 10^5) indicating the number of tokens on the board. Tokens are identified by distinct integers from 11 to TT. For i=1,2,,Ti = 1, 2,\dots , T, the ii-th of the next TT lines contains two integers X_iX\_i and Y_iY\_i (109X_i,Y_i109-10^9 ≤ X\_i , Y\_i ≤ 10^9), denoting the coordinates of the token. No two tokens have the same location.

The next line contains an integer PP (1P1051 ≤ P ≤ 10^5) representing the number of players in the game. Players are identified by distinct integers from 11 to PP, according to the order they take turns. For i=1,2,,Pi = 1, 2, \dots , P, the ii-th of the next PP lines contains two integers A_iA\_i and B_iB\_i (109A_i,B_i109-10^9 ≤ A\_i , B\_i ≤ 10^9), indicating that the line in the card picked by player ii is y=A_ix+B_iy = A\_ix+B\_i.

출력

Output PP lines. For i=1,2,,Pi = 1, 2, \dots , P, the ii-th line must contain an integer K_iK\_i indicating the number of tokens that player ii receives, followed by K_iK\_i integers identifying those tokens in ascending order.