+ 3

You know about 1000-queens challenge?

Sorry for my english, i make a code, this code print the solution for case 700 queens in one second or less, but my teacher tell me: "not is the solution for the p-np problem" or something.

23rd Feb 2018, 12:30 AM
Berbex
Berbex - avatar
8 Antworten
+ 6
Are you sure you did the solution right? You basically need to place n queens on a board of 1000 by 1000 without any queen attacking the other one. In case someone is not familiar with it check the below link for some info http://indianexpress.com/article/technology/science/researchers-announce-1-mn-prize-to-build-computer-programme-to-solve-queens-puzzle-4827770/ A discussion about the same in the below post. https://www.sololearn.com/discuss/685610/?ref=app
23rd Feb 2018, 1:44 AM
Lord Krishna
Lord Krishna - avatar
+ 3
I'm not sure what you're asking. 3 lines: *. What I must do. *. What I did. *. Why it's "wrong" ...would help.
23rd Feb 2018, 12:52 AM
non
+ 2
What is wrong?, i catch the 1000 queens, but the one million need what?
23rd Feb 2018, 1:12 AM
Berbex
Berbex - avatar
+ 2
The idea is that the program you came up with must be able to solve the problem in the same amount of time it takes to verify that the solution is correct. The 1000 queens problem is a classic example of an NP-complete problem. What that means is that it's easy for a computer to tell if the placement of the queens is correct, but actually figuring out the correct placement of the queens is much harder. For this problem, verification is easy: all you have to do is check if any queens can be captured. Thing is, finding a solution is a lot more complex than that, since the number of possible solutions to the problem becomes exponentially larger when more queens are added. Your computer may be able to find a solution for 1000 queens within a second, but it takes only a few microseconds for the computer to determine whether or not the solution works. Sorry if that's complicated. This is one of the Millennium Prize Problems, and for good reason.
23rd Feb 2018, 5:31 AM
DaemonThread
DaemonThread - avatar
+ 2
DaemonThread, well said! If I might add, finding *a* solution to the n-queens problem is also fairly easy. There are well-known algorithms that would do it in linear time. If I'm not mistaken, it's about finding a solution to the n-queens COMPLETION problem, which starts with some queens already placed on the board. Now finding a polynomial-time algorithm to *that* would be something!
14th Aug 2018, 5:01 PM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
I solv the 1000 queens, but not is the necessary for one million, my question is why not?, Yes i solv this problem
23rd Feb 2018, 2:00 AM
Berbex
Berbex - avatar
+ 1
well i need search the all solutions for the problem?
23rd Feb 2018, 2:41 PM
Berbex
Berbex - avatar
+ 1
According to Wikipedia, placing each queen in its own row and column and then using heuristic analysis to find the worst conflict and move the piece accordingly is the best approach. There's a link to the article in the other thread.
23rd Feb 2018, 11:19 PM
non