For the May 15 long challenge problem CHEFCK, I created a sparse matrix to create a cache and then process the queries in O(1) time. But it gives me wrong answer for this code. If I try to change from unsigned int to unsigned long long int, it gives Runtime Error. Can anyone help me find what is wrong? The Sparse Matrix algorithm that I have used is the same logic I used for FRMQ (for which I got AC). FRMQ Sparse Table Algo. asked 25 May '15, 11:53

One problem with your code  Do not use mod with sum. May be other also . answered 25 May '15, 23:35

Instead of converting sparse table to unsigned long long int you may change a little bit in your algorithm i.e. in the sparse table just note the positions of the minimum elements of sub range not the values as given in topcoder tutorial which is memory efficient. answered 26 May '15, 14:03
