_jarvis_'s blog

By _jarvis_, history, 8 years ago, In English

I was learning sqrt decomposition, to practise for the same i was solving http://www.spoj.com/problems/UNTITLE1/ problem on spoj, but i am continously getting SIGSEGV error for the same, i tried my level best to debug it but was unable to solve it,moreover there is no online reference for this particular problem,

i know the hopes of getting myself help is low but still if someone wanna help , here is my code http://ideone.com/jePYPu , i tried to make it as clean as possible.

Full text and comments »

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

By _jarvis_, history, 8 years ago, In English

i tried to google regarding this doubt but there was no specific clarification, first i would state the theoram, then i will ask the doubt

Theoram

according to my understanding, chinese remainder theoram is stated as,

for some number x, if we want to find x % M,

where M = m1*m2....*mr , (all mi being relatively prime to each other)

then we may do it as,

if x = ai(mod mi)

then x%M = a1*b1*(M/m1) + ...... + ai*bi*(M/mi) + ...... + ar*br*(M/mr)

where bi*(M/mi) = 1(mod mi)

DOUBT

1)i just wanted to know that can bi be fractional or it has to an integer value ? [got cleared answer is Integer only]

2)what if the sum

a1*b1*(M/m1) + ...... + ai*bi*(M/mi) + ...... + ar*br*(M/mr)

exceeds M? (or are we sure it would always be less then M)

Full text and comments »

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

By _jarvis_, history, 8 years ago, In English

I was solving a problem on spoj, the solution of that problem requires the assumtion that,

if we add the absolute value of 2 or more linear equation in x ( eg. f(x)=|5x-8| + |7x-1| + |12x-13| ) then it necessary that f(x) (note:here f(x) denotes the sum of those terms) would be montonically increasing as we go way from the optimal value of x (note: optimal value of x is the value at which f(x) is minimum) .

Just wanted to confirm if that statement is true or not?

Full text and comments »

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