Comments

Hello, I found a very weird bug in my code for problem E. It works fine for many test cases except for the case when n = 2 and the 2 numbers are distinct. I checked on my local machine and it gives the error.

*** Error in `./a.out': munmap_chunk(): invalid pointer: 0x00005613cbdd2788 ***

Checking on gdb, I find that the pointer majt remains the same as mait, even though I'm doing majt--; which should make it ma.end() if we are removing the first number (Note that this works for other test cases, i.e. n!=2, even for n=1). I'm unable to figure out why. Any help would be appreciated. Thank you.

Code ID: 33351982

2
1 2

Thank you for the advice

I forgot that pow can return a number slightly lesser than the number. Thank you for the clarification.

For powers of 10, I don't think there is any problem with precision. If there is an error, it'll occur in the decimal places and it'll be ignored. Is there any case where a this conversion won't work? Thank you for your reply

Hello, I have a small doubt regarding problem E. My submission 23125639. The code for converting string to integer is for(int i=0; i<lol.size(); i++) cnt[(j-1)/2]+=(lol[i]-'0')*(int)pow(10, lol.size()-i-1); This is giving me wrong answer on test 18. But when I replace this with the inbuilt function, atoi(), the code is getting accepted. I'm unable to understand why. Help would be appreciated