P10386 [Lanqiao Cup 2024 NOI Qualifier A] Gomoku Game
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 × 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 × 5$ square grid board, with a total of $25$ 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 $25$ 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.
Explanation/Hint
Translated by ChatGPT 5