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

F. Mentors

설명

3

The Happy Tree Friends have gathered for their annual meeting, in which they take their most important decisions for the year to come. This year, they will set up a mentoring program to help each other take better care of their loved ones. This programme follows a tree-like hierarchical structure as follows.

The \(N\) members of the programme are ranked from \(1\) to \(N\) (each rank is assigned once), by increasing seniority. For the mentorship programme to be efficient, a person ranked \(A\) can mentor a person ranked \(B\) only if \(A > B\). The most senior Happy Tree Friend can have no mentor, but everybody else has a unique mentor. Conversely, everybody is allowed to mentor from zero to two people.

However, Mr. Pickles, who was assigned the rank \(R\), plans to take a sabbatical this year. Thus, he will not be able to mentor anybody, and the Happy Tree Friends should choose their hierarchical structure among those trees in which the node labelled \(R\) is a leaf.

Aiming to help his friends to choose such a tree, Mr. Pickles decides to first count how many trees would match his constraint. Unfortunately, he stopped school early, and thus did not learn how to manipulate integers of arbitrary size. Instead, he counts modulo \(M\), where \(M\) is a fixed positive integer: this is already enough for most purposes in life.

What is the number \(L\) that Mr. Pickles will obtain after counting all suitable trees?

제약
입력 형식

The input consists of a single line, with three space-separated integers: \(R\), \(N\), \(M\), in that order.

출력 형식

The output should contain a single line with the single integer \(L\), which is the number of tree-like hierarchical structures that would match Mr. Pickles' constraints, counted modulo \(M\).

예제 1
입력
2 4 2
출력
1
예제 2
입력
2 4 3
출력
0
문제 정보

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

출처 ICPC SWERC 2020

평가 및 의견

F. Mentors

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

Log in to rate problems.

개별 의견

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

풀이 제출

F. Mentors

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