#P12010. 【MX-X10-T6】[LSOT-4] 集合

    ID: 11567 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学数论中国剩余定理 CRTLucas 定理梦熊比赛

【MX-X10-T6】[LSOT-4] 集合

Description

Let the universal set be UU.

An operation scheme is defined as assigning to each non-empty subset SUS \subseteq U a representative element r(S)r(S) chosen from SS.

An operation scheme is good if and only if for every non-empty subset SUS \subseteq U, it satisfies the following: for any partition of SS into mm non-empty subsets A1,A2,,AmA_1, A_2, \ldots, A_m, there exists 1im1 \le i \le m such that r(Ai)=r(S)r(A_i) = r(S).

Given U={1,2,,n}U = \{1, 2, \ldots, n\}, compute the number of essentially distinct good operation schemes modulo 10000000871000000087.

Two operation schemes are essentially distinct if and only if there exists at least one non-empty subset SUS \subseteq U where r(S)r(S) differs between the two schemes.

Input Format

A single line containing two positive integers n,mn, m.

Output Format

A single integer, the number of good operation schemes modulo 10000000871000000087.

3 1

24

3 2

6

4 3

2592

114514 3

750017326

114514 19198

274658403

Hint

Sample Explanation #1

All schemes are good, so the answer is 13×23×3=241^3 \times 2^3 \times 3 = 24.

Sample Explanation #2

The six valid schemes are:

  1. r({1,2,3})=1r(\{1, 2, 3\}) = 1, r({1,2})=1r(\{1, 2\}) = 1, r({1,3})=1r(\{1, 3\}) = 1, r({2,3})=2r(\{2, 3\}) = 2, r({1})=1r(\{1\}) = 1, r({2})=2r(\{2\}) = 2, r({3})=3r(\{3\}) = 3;
  2. r({1,2,3})=1r(\{1, 2, 3\}) = 1, r({1,2})=1r(\{1, 2\}) = 1, r({1,3})=1r(\{1, 3\}) = 1, r({2,3})=3r(\{2, 3\}) = 3, r({1})=1r(\{1\}) = 1, r({2})=2r(\{2\}) = 2, r({3})=3r(\{3\}) = 3;
  3. r({1,2,3})=2r(\{1, 2, 3\}) = 2, r({1,2})=2r(\{1, 2\}) = 2, r({1,3})=1r(\{1, 3\}) = 1, r({2,3})=2r(\{2, 3\}) = 2, r({1})=1r(\{1\}) = 1, r({2})=2r(\{2\}) = 2, r({3})=3r(\{3\}) = 3;
  4. r({1,2,3})=2r(\{1, 2, 3\}) = 2, r({1,2})=2r(\{1, 2\}) = 2, r({1,3})=3r(\{1, 3\}) = 3, r({2,3})=2r(\{2, 3\}) = 2, r({1})=1r(\{1\}) = 1, r({2})=2r(\{2\}) = 2, r({3})=3r(\{3\}) = 3;
  5. r({1,2,3})=3r(\{1, 2, 3\}) = 3, r({1,2})=1r(\{1, 2\}) = 1, r({1,3})=3r(\{1, 3\}) = 3, r({2,3})=3r(\{2, 3\}) = 3, r({1})=1r(\{1\}) = 1, r({2})=2r(\{2\}) = 2, r({3})=3r(\{3\}) = 3;
  6. r({1,2,3})=3r(\{1, 2, 3\}) = 3, r({1,2})=2r(\{1, 2\}) = 2, r({1,3})=3r(\{1, 3\}) = 3, r({2,3})=3r(\{2, 3\}) = 3, r({1})=1r(\{1\}) = 1, r({2})=2r(\{2\}) = 2, r({3})=3r(\{3\}) = 3.

Data Range

This problem uses subtasks with bundled testing.

  • Subtask 1 (5 pts): m=2m = 2.
  • Subtask 2 (6 pts): n4n \le 4.
  • Subtask 3 (10 pts): n3×103n \le 3 \times 10^3.
  • Subtask 4 (18 pts): m=1m = 1.
  • Subtask 5 (26 pts): m3×103m \le 3 \times 10^3.
  • Subtask 6 (35 pts): No additional constraints.

For all test cases: 1m<n2×1051 \le m < n \le 2 \times 10^5.

Translation by DeepSeek R1