dragneel3131's blog

By dragneel3131, history, 6 years ago, In English

https://www.codechef.com/problems/EFFPAINT This is a challenge problem in codechef where we have to minimize the score. Can someone explain a good approach for this problem.

Also this is the editorial for the problem https://discuss.codechef.com/questions/6549/effpaint-editorial

I am not able to understand the editorial. The use of terms cells, rectangles and corners is not much clear in it. Can someone please explain this approach? One can refer to the setter's solution for better understanding on the approach used.

Kindly help.

Full text and comments »

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

By dragneel3131, history, 7 years ago, In English

I have to calculate the value of (a/b) mod p where p may or may not be a prime number. For p being prime, I can simply find (b inverse for mod p) using euclid theorem or little fermat theorem, and perfrom (a * inverse(b)) % p. But in case p is not prime, how can I find the solution? I think there is a method by doing prime factorization of p and then using chineese remainder theorem but not sure about it. Can anyone help how can I solve this problem?

a and b both are less than p.

Full text and comments »

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