I know the basic of IDA* search, heuristic function etc. . But I can not solve this problem of lightoj . http://lightoj.com/volume_showproblem.php?problem=1121&language=english&type=pdf . here time limit is 2.00 second and Memory limit is 32 MB . But there are also a same problem on UVa online judge . . https://uva.onlinejudge.org/external/101/10181.pdf . It's time limit is 15.00 seconds. I can solve this in .750 second. . But in lightoj time complexity is very tight so I am getting TLE everytime.
My code for Lightoj problem is . https://pastebin.com/QSCXhSMp . Where is the problem?? I think on lightoj there are many(100) test cases . So i need to optimize it . How to optimize ??