#P17231. [Math×Girl²] 染色⁴
[Math×Girl²] 染色⁴
Background

Problem Description
You are given a four-dimensional grid, where each cell can only be black or white.
How many coloring schemes are there such that, in every subgrid, there are exactly black cell?
Since the answer may be very large, you only need to output the result modulo .
Input Format
The first line contains an integer , the number of test cases.
The next lines each contain five integers , and it is guaranteed that .
Output Format
Output lines, each containing one integer: the number of schemes modulo .
1
3 2 2 2 2
744944653
Hint
Sample Explanation
See Coloring³ for details.
Constraints and Notes
| Test Point | Score | Special Property | ||
|---|---|---|---|---|
| - | ||||
| - | ||||
| ^ | ||||
| - | ||||
| - | ||||
| - | ^ | |||
| ^ | ||||
For of the testdata: , , .
To prevent you from “cheating the testdata”, such as by looking at the returned results or using binary search to recover the input.
Therefore, this problem uses a Special Judge, and each evaluation uses random testdata.
Later I was reminded that the Special Judge can directly remove returned information, and the data you get is useless anyway. I’m an idiot.
It is guaranteed that each test point can be finished within , see the judge records. I was still too kind.
Translated by ChatGPT 5