eddycael's blog

By eddycael, history, 8 years ago, In English

Hi. I tried to solve this problem: NKMARS . My aproach is: Use sweepline algorithm, sort the events in opening vertical segments and closing vertical segments. Then for each value of X, add the current area to the answer and update the current 'window' of active segments in Y coordinate(from the left to the right). I think that a Segment Tree with lazy propagation must be useful here. But I dont know what data I would save for a single node in the Segment Tree. Can anyone help me? thanks in advance (Sorry for my poor english).

Full text and comments »

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

By eddycael, history, 9 years ago, In English

Hi... I am trying to solve this problem

I learned about Ternary Search and my code works for the test cases in the sample. Can anyone tell me some hint? this is my code Thanks in advance and sorry for my poor english

Full text and comments »

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

By eddycael, 9 years ago, In English

Hi, I learned about modular multiplicative inverse with modulo M (M is a prime number) using: (a^(M-2) ) MOD M

Now I would like to learn how calculate modular multiplicative inverse with modulo no prime.

Could someone give me one or two examples how to calculate it? For example COMB(8,3) = 8! /(3! * (8-3)!) = 56 , then COMB(8,3) MOD 6 = 2.

Thanks in advance. (Sorry for my poor english)

Full text and comments »

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

By eddycael, 9 years ago, In English

I would like to have help learning Dynamic Programming, since the subject is unknown at my university, but I like to solve programming problems in online judges, and I would like to continue learning.

I have read about DP on sites like TopCoder. After think a lot I could solve the knapsack problem 0-1, the problem of coins, and others ... anyone know of similar problems? to begin improving in DP. Sorry for my poor English. Thanks in advance...

Full text and comments »

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