1074 - N-Queens Problem

Discussion around the problems of the COJ.
Forum rules
Remember that posting AC code is not allowed here. If you are going to ask a question or to post a solution, describe your algorithm instead. Posting AC code will be penalized.
Post Reply
User avatar
dovier
Posts: 1143
Joined: 8 years ago
Location: Havana, Cuba
Gender: Male
Cuba

1074 - N-Queens Problem

Post by dovier » 8 years ago




User avatar
jose92
Posts: 24
Joined: 6 years ago
Location: Cienfuegos
Gender: None specified

Re: 1074 - N-Queens Problem

Post by jose92 » 6 years ago

The number of solutions for the 8-Queen problems is 92,why in the description of this problem it say that is 72?

User avatar
Dariel
Posts: 51
Joined: 8 years ago
Location: Santiago de Cuba
Gender: None specified
Contact:

Re: 1074 - N-Queens Problem

Post by Dariel » 6 years ago

description:
English:
...."The great mathematician Carl F. Gauss, the greatest genius of the modern era, became interested in the "eight queens problem" and found only 72 solutions."...
He only found 72 solutions, this does not mean that for 8 queens that is the number of solutions ...

Spanish:
El solo halló 72 soluciones, esto no quiere decir que para 8 reinas esa es la cantidad de soluciones...
Good luck!

Looney
Posts: 5
Joined: 5 years ago
Gender: None specified

Re: 1074 - N-Queens Problem

Post by Looney » 5 years ago

I believe i have made a solution which works
for board size 1 it gives 1
for baord size 2 and 3 it gives no solution
for board size 4 it gives 2 solutions
for board size 8 it gives 92 solutions
for board size 12 it gives 14200 solutions
but it fails test 0.
What are the tests in test 0 ?

humbertodiaz
Posts: 97
Joined: 5 years ago
Gender: None specified

Re: 1074 - N-Queens Problem

Post by humbertodiaz » 5 years ago

No one knows the test cases, except the administrators and the author of the problem. I don't think they're going to reveal the test. That said, note that the exercise isn't just about printing the number of solutions. It also requires printing the solutions themselves in a specified way. It's possible that you might be counting the number of solutions correctly, but that the printing portion is wrong. Also, make sure to print the no-solution message precisely as specified: "No Solution."

Looney
Posts: 5
Joined: 5 years ago
Gender: None specified

Re: 1074 - N-Queens Problem

Post by Looney » 5 years ago

I did double check all that. So i am giving up on trying to pass the test. I do believe the output my solution is producing matches the samples provided. I even tried submitting with an appended space in the end of each line.

humbertodiaz
Posts: 97
Joined: 5 years ago
Gender: None specified

Re: 1074 - N-Queens Problem

Post by humbertodiaz » 5 years ago

Want to bet? ;) I've figured out a way to handle this. I've solved the exercise and there aren't many inputs. So I can just run both of our solutions and compare their outputs. You would need to send me your code, though.

Looney
Posts: 5
Joined: 5 years ago
Gender: None specified

Re: 1074 - N-Queens Problem

Post by Looney » 5 years ago

Hi humbertodiaz,
I would like to take you up on your offer. I will email you my solution.

User avatar
ymondelo20
Posts: 1968
Joined: 8 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified
Contact:

Re: 1074 - N-Queens Problem

Post by ymondelo20 » 5 years ago

Ummm...
Numbers appears to be fine.
I guess that you could be printing solutions incorrectly.

regards.
"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

humbertodiaz
Posts: 97
Joined: 5 years ago
Gender: None specified

Re: 1074 - N-Queens Problem

Post by humbertodiaz » 5 years ago

I checked his solution and the problem was surprisingly simple - his solution was only processing one case. It was not designed to handle multiple cases. He fixed that but now there's some performance issues, heh.

Post Reply

Return to “Problem set”