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

Kocke

Unrated 레이팅 미적용
난이도
2s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

For his thirteenth birthday, Donald’s parents bought him a bra\(nd-ne\)w set of Lego
cubes. In the set, there are \(n\) cubes of equal size, where the \(i-th\) cube came in
color \(i\). Using these cubes he decided to build a wall.
Donald will build his wall on a r\(ow-li\)ke Lego base that has \(k\) places where cubes
can be put in. He puts the cubes in the following way:
• First, he puts the cube with color 1 on an arbitrary spot on the base.
• For each cube from 2 to \(n\), he places it in a spot neighboring the previously
placed cube. If that spot isn’t empty, he puts the new cube on top of all the others.
After he built the wall, Donald wrote on a piece of paper a sequence of length \(k\): on the \(i-th\) position in
the sequence he wrote the color of the top cube in the \(i-th\) place, or 0 if there isn’t a cube in that place.
He immediately asked himself how many different sequences could he have written on the piece of paper.
Two sequences are considered different if there exists a position in which they differ. After some time, he
has managed to calculate the solution, but he is not sure whether it is correct, so he asks for your help.

제약

Subtask 1 (20 points): n, \(k \le 18\)

Subtask 2 (30 points): n, \(k \le 50\)

Subtask 3 (30 points): n, \(k \le 500\)

Subtask 4 (30 points): No additional constraints.

입력 형식

The only line has integers \(n\) and \(k\) (\(2 \le n\), \(k \le 5\,000\)), the number of cubes, and the length of the base.

출력 형식

In the only line, print the answer to Donald’s question, modulo \(10^{9} + 7\).

서브태스크
서브태스크점수설명

1

20점

n, \(k \le 18\)

2

30점

n, \(k \le 50\)

3

30점

n, \(k \le 500\)

4

30점

No additional constraints.

예제 1
입력
4 3
출력
8
예제 2
입력
3 5
출력
14
예제 3
입력
100 200
출력
410783331
설명

Clarification of the first example:
All possible sequences are: (0, 3, 4), (2, 3, 4), (0, 4, 3), (1, 4, 3), (4, 3, 0), (4, 3, 2), (3, 4, 0), (3, 4, 1).
Clarification of the second example:
One of the possible sequences is (0, 3, 2, 0, 0). Donald can achieve that by putting the first cube on the
second place, second cube on the third place, and third cube on the second place (on top of the first cube).

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2023/2024 Contest 1

평가 및 의견

Kocke

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Kocke

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