#P15431. [蓝桥杯 2025 国 Python B] 派对邀请方案
[蓝桥杯 2025 国 Python B] 派对邀请方案
Problem Description
Lanqiao Company is located in the Cloud City and has employees. Each employee has a unique ID from to . Every year, the company holds a grand party and invites some employees to improve team bonding.
In the company structure, for every employee with ID , their direct boss has ID . To keep the party relaxed, the company sets a rule: if employee is invited to the party, then their direct boss must not be invited. This rule comes from last year’s party, when an employee and their boss showed up at the same time and caused awkward “report-style chatting”, which ruined the fun atmosphere.
Now, your task is to compute how many invitation plans there are such that for any invited employee , their direct boss is not invited. Since the answer may be very large, you only need to output the result modulo . An invitation plan means a choice of a set of employees to attend the party (the order of invitation does not matter) that satisfies the rule above. For example:
- Inviting is valid, because the bosses of employees are not invited.
- Inviting is invalid, because employee ’s boss is invited.
- Inviting no one (the empty set) is also valid, because no employees are invited, so the rule is naturally satisfied.
Output Format
This is an output-only fill-in-the-blank problem. You only need to compute the result and submit it. The result is an integer in the range from to . When submitting, only fill in this integer; any extra content will not be scored.
Hint
Translated by ChatGPT 5