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

24618번 - Robot Instructions 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB48616312833.862%

문제

Bessie is learning how to control a robot she has recently received as a gift.

The robot begins at point $(0, 0)$ on the coordinate plane and Bessie wants the robot to end at point $(x_g, y_g)$. Bessie initially has a list of $N$ (1ドル\le N\le 40$) instructions to give to the robot, the $i$-th of which will move the robot $x_i$ units right and $y_i$ units up (or left or down when $x_i$ and $y_i$ are negative, respectively).

For each $K$ from 1ドル$ to $N,ドル help Bessie count the number of ways she can select $K$ instructions from the original $N$ such that after the $K$ instructions are executed, the robot will end at point $(x_g, y_g)$.

입력

The first line contains $N$. The next line contains $x_g$ and $y_g,ドル each in the range $-10^9 \ldots 10^9$. The final $N$ lines describe the instructions. Each line has two integers $x_i$ and $y_i,ドル also in the range $-10^9 \ldots 10^9$.

It is guaranteed that $(x_g,y_g)\neq (0,0)$ and $(x_i,y_i)\neq (0,0)$ for all $i$.

출력

Print $N$ lines, the number of ways Bessie can select $K$ instructions from the original $N$ for each $K$ from 1ドル$ to $N$.

제한

예제 입력 1

7
5 10
-2 0
3 0
4 0
5 0
0 10
0 -10
0 10

예제 출력 1

0
2
0
3
0
1
0

힌트

In this example, there are six ways Bessie can select the instructions:

(-2,0) (3,0) (4,0) (0,10) (0,-10) (0,10) (1 2 3 5 6 7)
(-2,0) (3,0) (4,0) (0,10) (1 2 3 5)
(-2,0) (3,0) (4,0) (0,10) (1 2 3 7)
(5,0) (0,10) (0,-10) (0,10) (4 5 6 7)
(5,0) (0,10) (4 5)
(5,0) (0,10) (4 7)

For the first way, the robot's path looks as follows:

(0,0) -> (-2,0) -> (1,0) -> (5,0) -> (5,10) -> (5,0) -> (5,10)

출처

Olympiad > USA Computing Olympiad > 2021-2022 Season > USACO 2022 February Contest > Silver 2번

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

출처

대학교 대회

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

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