Gives error on cc IDE
1 Like
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
Sorry, no idea😶
1 Like
Okay No Issues!!
1 Like
Cool, I used map there when the contest was live, without knowing unordered_map would get TLE.
Thanks for telling.
2 Likes
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
1 Like
Thanks For this Information !