Minions and the rooms
Time limit2sMemory limit512 MB
Rooms flip between available and unavailable over range updates; after each flip, count set partitions of N minions into the k currently available rooms, mod 880803841.
- Level
Medium6 of 10
- Topics
- Combinatorics, Intervals, Implementation
- Solved
- No attempts yet
Problem
Gru's basement holds minions numbered to . The basement has rooms of unlimited capacity, and every room is either available or unavailable. Each day Gru flips the state of every room in one consecutive range.
A minion can live only in an available room, and every available room must hold at least one minion. The rooms are indistinguishable: two arrangements and count as the same when, for every room in , some room in holds exactly the same set of minion numbers.
At the start every room is available. For each of the following days, report the number of arrangements right after Gru flips that day's range.
Input
The first line contains an integer , the number of test cases ().
The first line of each test case contains three space separated integers , and (, ).
Each of the next lines contains two space separated integers and (). On that day Gru flips the state of rooms .
Output
For each query, print the number of arrangements modulo on its own line.