We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I got 150 using 26 data structures, each of them got the update value in O(1) because of the constraint (m<=101), you can generate all posible remainders to each of the posibles values of m, and then you find the period in no more than m^2 . But when you read the editorial, they use binpow to get all the updates that cost a lot, but they solve the problem with just 5 data structures... nice problem!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Dynamic Summation
You are viewing a single comment's thread. Return to all comments →
I got 150 using 26 data structures, each of them got the update value in O(1) because of the constraint (m<=101), you can generate all posible remainders to each of the posibles values of m, and then you find the period in no more than m^2 . But when you read the editorial, they use binpow to get all the updates that cost a lot, but they solve the problem with just 5 data structures... nice problem!