Logo
(追記) (追記ここまで)

28041번 - Board Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB89343047.619%

문제

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 $T$ tokens on the board, which can be seen as points in the two-dimensional plane. There are $P$ 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)$ is strictly below a line $y = Ax + B$ if and only if $Y < AX + B$.

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

입력

The first line contains an integer $T$ (1ドル ≤ T ≤ 10^5$) indicating the number of tokens on the board. Tokens are identified by distinct integers from 1ドル$ to $T$. For $i = 1, 2,\dots , T,ドル the $i$-th of the next $T$ lines contains two integers $X_i$ and $Y_i$ ($-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 $P$ (1ドル ≤ P ≤ 10^5$) representing the number of players in the game. Players are identified by distinct integers from 1ドル$ to $P,ドル according to the order they take turns. For $i = 1, 2, \dots , P,ドル the $i$-th of the next $P$ lines contains two integers $A_i$ and $B_i$ ($-10^9 ≤ A_i , B_i ≤ 10^9$), indicating that the line in the card picked by player $i$ is $y = A_ix+B_i$.

출력

Output $P$ lines. For $i = 1, 2, \dots , P,ドル the $i$-th line must contain an integer $K_i$ indicating the number of tokens that player $i$ receives, followed by $K_i$ integers identifying those tokens in ascending order.

제한

예제 입력 1

5
0 0
5 0
4 3
2 4
2 -1
3
-1 5
0 2
1 1

예제 출력 1

2 1 5
1 2
1 3

예제 입력 2

2
0 0
1 1
2
0 1
0 1

예제 출력 2

1 1
0

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2022 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /