RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0511

Robot Instructions

Platinum IV 플래티넘 IV
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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)\).

*Note: the time and memory limits for this problem are 4s and 512MB, twice
the defaults.
*

Problem credits: Alex Liang

제약

SCORING

  • Test cases 2-4 satisfy \(N\le 20\).
  • Test cases 5-16 satisfy no additional constraints.

Problem credits: Alex Liang

입력 형식

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
출력
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)
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2021-2022 > February > Silver

태그

평가 및 의견

Robot Instructions

개요
출제자 난이도 Platinum IV 플래티넘 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Robot Instructions

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8