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

Cowmpetency

Gold II 골드 II
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Farmer John is hiring a new herd leader for his cows. To that end, he has
interviewed \(N\) (\(2 \leq N \leq 10^9\)) cows for the position. After each
interview, he assigned an integer "cowmpetency" score to the candidate ranging from \(1\)
to \(C\) (\(1 \leq C \leq 10^4\)) that is correlated with their leadership
abilities.

Because he has interviewed so many cows, Farmer John has forgotten all of their
cowmpetency scores. However, he does remembers \(Q\)
(\(1 \leq Q \leq \min(N - 1, 100)\)) pairs of numbers \((a_i, h_i)\) where cow \(h_i\)
was the first cow with a strictly greater cowmpetency score than cows \(1\)
through \(a_i\) (so
\(1 \leq a_i < h_i \leq N\)).

Farmer John now tells you the \(Q\) pairs of \((a_i, h_i)\). Help him count how many
sequences of cowmpetency scores are consistent with this information! It is
guaranteed that there is at least one such sequence. Because this number may be
very large, output its value modulo \(10^9 + 7\).

Problem credits: Suhas Nagar

제약

SCORING

  • Inputs 3-4 satisfy \(N \leq 10\) and \(Q, C \leq 4\).
  • Inputs 5-7 satisfy \(N, C \leq 100\).
  • Inputs 8-10 satisfy \(N \leq 2000\) and \(C \leq 200\).
  • Inputs 11-15 satisfy \(N, C \leq 2000\).
  • Inputs 16-20 satisfy no additional constraints.

Problem credits: Suhas Nagar

입력 형식

The first line contains \(N\), \(Q\), and \(C\).

The next \(Q\) lines each contain a pair \((a_i, h_i)\). It is guaranteed that all
\(a_j\) are distinct.

출력 형식

The number of sequences of cowmpetency scores consistent with what Farmer John
remembers, modulo \(10^9+7\).

예제 1
입력
6 2 3
2 3
4 5
출력
6
설명

The following six sequences are the only ones consistent with what Farmer John
remembers:

1 1 2 1 3 1
1 1 2 1 3 2
1 1 2 1 3 3
1 1 2 2 3 1
1 1 2 2 3 2
1 1 2 2 3 3
예제 2
입력
10 1 20
1 3
출력
399988086
설명

Make sure to output the answer modulo \(10^9+7\).

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2023-2024 > January > Gold

태그

평가 및 의견

Cowmpetency

개요
출제자 난이도 Gold II 골드 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Cowmpetency

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