You are not logged in. Please login at www.codechef.com 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

4★almondpie
36
accept rate: 0%


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

link

answered 25 May '15, 23:35

krish8764's gravatar image

4★krish8764
165369
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.

link

answered 26 May '15, 14:03

apptica's gravatar image

5★apptica
824210
accept rate: 17%

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

link

answered 26 May '15, 19:06

almondpie's gravatar image

4★almondpie
36
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×844
×168
×27
×6
×1

question asked: 25 May '15, 11:53

question was seen: 2,049 times

last updated: 26 May '15, 19:06