memeset's blog

By memeset, history, 8 years ago, In English

Hi everyone, On the recent codeforces round, I can't for the life of me figure out why my code is wrong.

My approach is to first compress all of ai and bi into at numbers that are at most 2 * 105 and then store dp[i]=highest possible height obtainable with topmost ring with i inner width. I update this by iterating through the input by nonincreasing b, using a binary indexed tree to find the max of the elements from 1 to the compressed bi - 1 of dp.

Any help would be appreciated.

EDIT: Hi everyone, I am curious as to why this post is being downvoted. I am not complaining, but I would like to know for the future, are these type of debugging posts frowned upon? If yes, where should I ask inquiries such as for debugging? Thanks!

Full text and comments »

  • Vote: I like it
  • -9
  • Vote: I do not like it

By memeset, history, 8 years ago, In English

Hi all,

Could someone please look at my code to this problem? Its a simple dfs with an extra iterating variable, but I'm confused as to why it's returning wrong answer. I'm 90% sure that the string processing part of my code is correct, so that leaves the dfs() function that probably has a bug in it.

vector< string > height[] is the array that I use to store the strings that are on a certain level, and I use vector< int > comma to store the position of the commas to make it easier to extract the numbers and the strings. Also, mx is the maximum height of a comment.

Thanks for your time everyone!

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By memeset, history, 8 years ago, In English

Hello everyone,

For the recent codeforces round #381, I submitted this code for the div2D/div1B question here. I am not sure why it is wrong...

The basic idea of my code was that I use binary lifting to store the 2^kth ancestor and the distance to the 2^kth ancestor in bparent[][] and bdist[][]. I then binary search for the highest ancestor that each node is controlled by and store the starting and ending points in event[], which i can just dfs and sum up in my function solve().

Could somebody please tell me where I went wrong in my code? Any help would be appreciated.

Thanks!

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By memeset, history, 8 years ago, In English

Hi everyone, I am getting a test case wrong for this problem and have already spent multiple days debugging. Could somebody please take a look at my code and help me find the bug?

A few things about the code: - an Event consists of an array of the lowest indexed people that are contained in a segment, in sorted order.

  • the array e[i][j] is the segment from vertex i to its 2^(j-1)th parent, inclusive, and stores events. e[i][0] is just that node's event, ie a segment with only itself.

  • dp[i][j] is the 2^jth parent of node i.

  • anc returns the kth ancestor of a vertex.

  • mergeevent merges two events' persons that are contained, while maintaining sorted order.

  • removeDup removes duplicates in the array.

Thanks everyone!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By memeset, history, 8 years ago, In English

Hello everyone. If anyone would be kind enough to help me debug my code to this problem I would appreciate it very much :) I would like it very much if I could AC this problem since I am very tilted by it right now as I have no idea why it's wrong :/ Thanks everyone!

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it