Fatal Error · Extreme CodeFree
Impossible Instructions
Every performer wears orange or purple. The director keeps adding and taking back instructions like 'these two match' or 'these two differ'. After each change, how many ways are there to dress the cast?
Print the count after every operation, modulo 1 000 000 007.
Every line must be exactly right.
N Q, performers and operations.Q lines: + id u v S, + id u v D, or - id to withdraw instruction id.Q lines: the number of colourings after each operation, modulo 1 000 000 007.N, Q ≤ 40 000; u ≠ v+ and withdrawn at most once4 7 + 1 1 2 S + 2 2 3 D + 3 1 3 S + 4 3 4 D - 3 - 1 + 5 1 4 D
8 4 0 0 2 4 2
Sign in to play. It is free.
Sign in