5 / 5
Dec 2021

I get WA on AVCHESS8. But you knew that from the problem title!

The code uses BFS, keeping track of the move count. Moves are rotated among knight, rook, and bishop. Since the problem is the minimum move count, a position are not revisited. When the target is reached, the move count is returned.

I used a driver and my code to process all 249,984 possible starting positions. The results are as follows:

Edit. Below information updated after AC!

Solution Count:  249984 = 64*63*62
length = -1, count = 126984
length =  4, count = 2168
length =  5, count = 7352
length =  6, count = 21080
length =  7, count = 56992
length =  8, count = 576
length =  9, count = 312
length = 10, count = 28688
length = 11, count = 112
length = 13, count = 5600
length = 16, count = 120

Any suggestions are appreciated.

The code is as follows:

** Removed with AC!
  • created

    Dec '21
  • last reply

    Dec '21
  • 4

    replies

  • 582

    views

  • 2

    users

  • 1

    link

If you want to post your testcases, I’ll run it through my solution and we’ll see if we can find any differences.

Scratch that, I just made some random ones. Here are a couple of test cases where your code and mine give different answers

2
2 5 2 4 0 0
1 5 7 3 0 0

My answers:

7
10

Your answers:

8
-1

I really appreciate the test cases. Investigations are in-progress.

Investigations complete! AC. Thanks for the assistance!
My hash code used to determine if a position had been seen previously was incorrect. Fixing this problem resulted in AC.