아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Robot Instructions

시간 제한4초메모리 제한1024 MB

요약
주어진 최대 40개의 이동 벡터 중에서 K개를 골라 합이 목표 점과 정확히 일치하는 경우의 수를 각 K마다 구한다.
난이도

보통10점 중 7점

유형
배열, 해시맵, 완전 탐색, 조합론
정답자
아직 제출이 없습니다

문제

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

The robot begins at point (0,0)(0, 0) on the coordinate plane and Bessie wants the robot to end at point (x_g,y_g)(x\_g, y\_g). Bessie initially has a list of NN (1≤N≤401\le N\le 40) instructions to give to the robot, the ii-th of which will move the robot x_ix\_i units right and y_iy\_i units up (or left or down when x_ix\_i and y_iy\_i are negative, respectively).

For each KK from 11 to NN, help Bessie count the number of ways she can select KK instructions from the original NN such that after the KK instructions are executed, the robot will end at point (x_g,y_g)(x\_g, y\_g).

입력

The first line contains NN. The next line contains x_gx\_g and y_gy\_g, each in the range −109…109-10^9 \ldots 10^9. The final NN lines describe the instructions. Each line has two integers x_ix\_i and y_iy\_i, also in the range −109…109-10^9 \ldots 10^9.

It is guaranteed that (x_g,y_g)≠(0,0)(x\_g,y\_g)\neq (0,0) and (x_i,y_i)≠(0,0)(x\_i,y\_i)\neq (0,0) for all ii.

출력

Print NN lines, the number of ways Bessie can select KK instructions from the original NN for each KK from 11 to NN.

힌트

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)

예제1

  1. 예제 1

    입력
    7
    5 10
    -2 0
    3 0
    4 0
    5 0
    0 10
    0 -10
    0 10
    
    예상 출력
    0
    2
    0
    3
    0
    1
    0