This is my code for this problem suggest how to pass all test cases
4/5 Test cases passing, one is showing TLE
your code is giving wrong answer for n=11 , your code output is tle correct output is 2680
use optimzesolution
if Queen is placed in particular row then change row value