11538  Chess Queen
Moderator: Board moderators
11538  Chess Queen
I solved this problem in 2 ways, but I got 7 WA's in contest. Can anybody give some test cases plz? I really have no idea why I'm getting WA
Re: 11538  Chess Queen
It is easy when N=1. You can find a formula.
Then you can find all possibilities horizontal and verticals.
After that you need to calculate diagonals (2 kind). The hardest thing might be the case N!=M.
Here is one formula you may use 1+4+9+...+n*n=n(n+1)(2n+1)/6
Good luck.
Then you can find all possibilities horizontal and verticals.
After that you need to calculate diagonals (2 kind). The hardest thing might be the case N!=M.
Here is one formula you may use 1+4+9+...+n*n=n(n+1)(2n+1)/6
Good luck.

 Learning poster
 Posts: 58
 Joined: Wed Dec 31, 2003 8:43 am
 Location: Dhaka, Bangladesh
 Contact:
Re: 11538  Chess Queen
visit: http://www.youngprogrammer.com to get test data
Re: 11538  Chess Queen
Thank you for your help Chimed. I used a formula to calculate result, and tested the program with LIMON's test data and it gives correct answer, but I'm still getting WA . This is my code:
Code: Select all
AC...
Last edited by azk84 on Mon Oct 27, 2008 6:04 pm, edited 1 time in total.
Re: 11538  Chess Queen
You are having integer overflow. Check for n = 1000000 and m = 1000000.
Re: 11538  Chess Queen
Thank you Samiul and SeregiB for your help! I finally got AC after 8 tries
Re: 11538  Chess Queen
Why i got wa so many times?
Code: Select all
removed
Last edited by Obaida on Sun Apr 05, 2009 8:42 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Re: 11538  Chess Queen
Does your program print the sample output correctly..??
Re: 11538  Chess Queen
I solved the problem... n m sorry 4 d previous post.
That wasn't the real 1.
That wasn't the real 1.
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.