luogu#P1896. [SCOI2005] 互不侵犯

    ID: 861 Type: RemoteJudge 1000ms 125MiB Tried: 1 Accepted: 1 Difficulty: 7 Uploaded By: Tags>动态规划 DP2005四川各省省选深度优先搜索 DFS轮廓线 DP状压 DP

[SCOI2005] 互不侵犯

Problem Description

On an N×NN \times N chessboard, place KK kings so that they do not attack each other. How many placement schemes are there? A king can attack one square in each of the eight directions: up, down, left, right, and the four diagonals (upper-left, lower-left, upper-right, lower-right), for a total of 88 squares.

Input Format

There is only one line containing two integers N,KN,K.

Output Format

The number of such arrangements.

3 2

16

Hint

Constraints and Conventions

For all testdata, 1N91 \le N \le 9, 0KN×N0 \le K \le N\times N.


upd 2018.4.25\text{upd 2018.4.25}: The testdata has been strengthened.

Translated by ChatGPT 5