pizza_hot's blog

By pizza_hot, history, 8 years ago, In English

Hello codeforces!

I learned code 2 years ago (I don't solve much problems on codeforces ) . my question is : when I'm in a contest I feel stressed so I can't do well in the contest with enough speed or with enough problems (often I can solve these problems out of the contest shortly).

So what do you think I should do to be better :/ ?

sorry for my bad English and thanks in advance...

Full text and comments »

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

By pizza_hot, history, 8 years ago, In English

Hi !

I 'm trying to solve This problem using Treap (After i read this great blog) but I'm getting wrong answer ,the example is right but I don't know where the bug is ,here's my code can someone tell me what's wrong :/ ?

sorry for my bad English and thanks in advance...

Full text and comments »

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

By pizza_hot, history, 8 years ago, In English

Hi Everyone! I'm trying to solve this problem (it's a basic convex hull optimization problem), but because I learned it recently I find a problem with understanding the bottom up solution.

is there any top-down one ? if you have share your code please,thanks in advance.

Full text and comments »

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

By pizza_hot, history, 8 years ago, In English

Hi Everyone !

I was studying convex hull trick from here

I understood the main idea but I didn't understand the solution for the problem ACQUIRE

My question is :

they sorted rectangles by height in ascending order (if they are equal put the rectangle with the largest weight first)

and this is their pseudo code:

input N
for i=1 to N
     input rect[i].h
     input rect[i].w
let cost[0] = 0
for i=1 to N
     let cost[i] = OO
     for j=0 to i-1
         cost[i] = min(cost[i],cost[j]+rect[i].h*rect[j+1].w)
print cost[N]

but it's not necessary for every j<i : rect[j].w >rect[i].w (because we are comparing by the height first)

can someone tell me why did they do this ? :/

or have you got a better explain for the solution ?

sorry for my bad english , thanks in advance

Full text and comments »

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