#P2051. [AHOI2009] 中国象棋

    ID: 993 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp递推2009各省省选安徽状态压缩,状压

[AHOI2009] 中国象棋

Description

This time, Xiao Keke wants to solve a problem related to Chinese chess. On an nn row by mm column board, place any number of cannons (possibly 00) so that no cannon can attack another. How many placement methods are there? As you surely know, in Chinese chess the cannon’s attack rule is: one cannon attacks another if and only if they are in the same row or the same column, and there is exactly one piece between them. Come exercise your thinking with Xiao Keke!

Input Format

One line contains two integers n,mn, m, separated by a space.

Output Format

Output the total number of valid placements. Since this number can be large, output the result modulo 99999739999973.

1 3
7

Hint

Sample Explanation

Except for the configuration where all 33 cells are filled with cannons, all other configurations are valid, so there are 2×2×21=72 \times 2 \times 2-1=7 valid configurations.

Constraints

  • For 30%30\% of the testdata, nn and mm do not exceed 66.
  • For 50%50\% of the testdata, at least one of nn and mm does not exceed 88.
  • For 100%100\% of the testdata, 1n,m1001 \leq n, m \leq 100.

Problem statement updated by: @syksykCCC.

Translated by ChatGPT 5