Gives error on cc IDE
Thank You So much For the Explaination!
Now The Question Arises why using array for hashing passes in this Problem?
Because Array can access maximum index as [(10^6)-1] and how is it accessing [(10^7)-1] index?
Using Array Gives AC
I just ran on Codechef IDE it executes successfuly giving output as 3
Max size of array in main is between 1e6 to 1e7 according to this.
Okay Thanks for it!
But Can You Tell why is this is running successfully?
Sorry, no idea😶
Okay No Issues!!
Cool, I used map there when the contest was live, without knowing unordered_map would get TLE.
Thanks for telling.
Running this code locally gave segmentation fault, which was expected.
But on ideone it declares an array of size INT_MAX (due to 1e20 overflow prolly).
It prints a[n - 1] = 3, and the sizeof array = 8589934588.
link
Thanks For this Information !