#P6162. [Cnoi2020] 四角链
[Cnoi2020] 四角链
Description
In fact, a quadrilateral chain can be abstracted as a grid. Each cell is numbered , , , , respectively.
Each cell can take one of two choices:
- Leave it empty.
- Fill in a positive integer that is less than or equal to its own index.
If a filling scheme does not have two cells filled with the same number, Cirno calls it a valid scheme.
Cirno wants to know the number of valid schemes in which exactly cells are filled with numbers, modulo .
Input Format
One line containing two integers , .
Output Format
One line containing one integer, the answer.
10 5
42525
642 357
409821948
666666 233333
791003566
Hint
Constraints
This problem uses bundled testdata.
- Subtask 1 ( ): .
- Subtask 2 ( ): .
- Subtask 3 ( ): no special constraints.
For of the testdata: .
Notes
- The following references are not necessary to read.
Reference
- [1] CNKI - Some Extremal Problems of Quadrilateral Chains - Xiamen University - Zeng Yanqiu
http://kns.cnki.net/KCMS/detail/detail.aspx?dbcode=CMFD&filename=2007056552.nh - [2] CNKI - On the Hamming Gracefulness of Quadrilateral Cactus Graphs - Education Technology Center, Jilin Engineering and Technical Teachers College; College of Science and Engineering, Hainan University - Li Xiufen; Pan Wei
http://www.cnki.com.cn/Article/CJFDTotal-CCYD200806009.htm
Translated by ChatGPT 5
京公网安备 11011102002149号