Working on all given test cases and also on my custom tests but still Wrong Answer (TALAZY)

The Link to Question is here


and my solution Link is this
https://www.codechef.com/viewsolution/27614817
I want to know in which test case my solution will fail and also what is wrong with my solution.

At a guess, I’d say it’s because you’re mixing floating point (std::pow) with integers, but I can’t actually find a testcase that fails (and I’ve tried over 100000 random ones!).

2 Likes

I want to learn how you generate random test cases and test to your solution.and yeah sometimes it’s frustating when your answer is wrong and you can’t find any bug in your code.

2 Likes

Not much to it, usually: see e.g. this post and some specific examples from this OCT19A:

https://www.codechef.com/viewsolution/27041284 (BACREP)
https://www.codechef.com/viewsolution/27047600 (MSV)
https://www.codechef.com/viewsolution/27045331 (MARM)
https://www.codechef.com/viewsolution/27043624 (EVEDG)

1 Like

Guess what, the best possible random test case generator for such problems is a human. I figured out that b has no contribution to any error. I’m left with n and m. Let’s assign the maximum possible values to n and m and compare the results produced by your program and mine for the test case:
n = 100000000
b = 1
m = 100000000
Your code produces : 135215232000000016
& my code produces: 135215232000000026
:slightly_smiling_face:

1 Like

13 1 2
N b m
7,3,2,1
× 2, 22, 222 ,2222
.+ 1 ,1,1
Total needed minutes for jem = 103 minutes
How is the example is it helpful.