Comments

To explain why:

diff = n — p => 1 (for n = 3 & p = 2) for (int i = 0; i < diff; ++i) runs only once flag == false (since v[0] = 1 and v[2] = 0 output is "No" which is produced by my compiler but WA on codeforces. Can't understand... PLEASE HELP!

My code runs perfectly okay on test 18 of B but it is giving an WA on test case 18. I am using g++ compiler on my pc. Can't understand why, since the output it produces in the test case should not be produced by program logic.

Submission link : My Submission

Any insight would be helpful.

Thanks!!!

Sorry, I am a newbie and I am confused in the mathematical notation | in (q ∣ p⋅b^k). Can anyone please explain?