You are not logged in. Please login at to post your questions!


Chef And Cake - WA

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

almondpie's gravatar image

accept rate: 0%

One problem with your code - Do not use mod with sum. May be other also .


answered 25 May '15, 23:35

krish8764's gravatar image

accept rate: 0%

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

apptica's gravatar image

accept rate: 17%

I tried doing it : code. It still gives me WA.


answered 26 May '15, 19:06

almondpie's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 25 May '15, 11:53

question was seen: 2,049 times

last updated: 26 May '15, 19:06