#P10386. [蓝桥杯 2024 省 A] 五子棋对弈

    ID: 11878 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>2024深度优先搜索 DFS蓝桥杯省赛

[蓝桥杯 2024 省 A] 五子棋对弈

Problem Description

“In a game of Gomoku, can a friendship sink in an instant?” No. For Xiao Lan and Xiao Qiao, Gomoku is not only a battle on the board, but also communication from heart to heart. Following the principle of “friendship first, competition second,” these two close friends decide to determine the outcome on a 5×55 × 5 board using black and white stones. But neither of them wants the other to feel upset, so they decide to use a draw (tie) as a witness to their friendship.

The match follows these rules:

  1. Board size: The match is played on a 5×55 × 5 square grid board, with a total of 2525 cells that can be used for placing stones.
  2. Stone types: There are two kinds of stones, black and white, representing the two players. Xiao Lan uses white stones, and Xiao Qiao uses black stones.
  3. First-move rule: White (Xiao Lan) moves first, i.e., places a stone first when the board is empty.
  4. Alternating moves: The players take turns placing their own stones on the board, placing exactly one stone each turn.
  5. Winning condition: The first player to form five consecutive stones of the same color in a row, column, or diagonal wins.
  6. Draw condition: When all 2525 cells are filled and no winner is decided, the game ends in a draw.

Under this setting, Xiao Lan and Xiao Qiao want to know how many different endgame board positions there are (different final positions are considered different; the same final position with different move orders is considered the same), such that the board is completely filled and the result is a draw.

Input Format

This is an output-only fill-in-the-blank problem. You only need to compute the result and submit it. The answer is an integer. When submitting, only fill in this integer; any extra content will result in no score.

Output Format

This is an output-only fill-in-the-blank problem. You only need to compute the result and submit it. The answer is an integer. When submitting, only fill in this integer; any extra content will result in no score.

Hint

Translated by ChatGPT 5