-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Knight's Tour #2
Comments
Hello @anishagg17! Sure. I'm using Warnsdorf ’s rule. According to Antti Laaksonen - Competitive Programmer's Handbook:
CSES-Solutions/src/1689 - Knight's Tour.cpp Lines 66 to 67 in becd3cc
And then I'm sorting the cells according to the number of possible moves so that I can move my knight to the cell from which the least number of moves are possible (Warnsdorf's rule).
The grid contains 0 on empty cells and a positive number on the occupied cells. I'm checking |
but the cell should be grid[x2][y2], I think |
Suppose my knight is currently at the cell Cells |
CSES-Solutions/src/1689 - Knight's Tour.cpp Lines 51 to 58 in becd3cc
empty neighbors to (x1,y1) are (x2,y2) , so why are you checking if (x1,y1) is empty on I just mean to say
Should this be changed to
|
I realized the mistake. Yes, it should be changed. |
https://github.com/mrsac7/CSES-Solutions/blob/master/src/1689%20-%20Knight's%20Tour.cpp
Hello @mrsac7 can you please explain to me why do we need to sort the points,
CSES-Solutions/src/1689 - Knight's Tour.cpp
Line 70 in becd3cc
!grid[x1][y1]
inCSES-Solutions/src/1689 - Knight's Tour.cpp
Line 55 in becd3cc
The text was updated successfully, but these errors were encountered: