title: how to make the sequence a non-decreasing sequence with the minimum number of steps?
body: <p>Here is the <a href="http://www.codeforces.com/contest/13/problem/C" rel="nofollow">problem</a> states that</p>
  
  <blockquote>
    <p>given a sequence of N integer numbers. At each step it is allowed to increase the value of any number by 1 or to decrease it by 1. The goal of the game is to make the sequence non-decreasing with the minimum number of steps</p>
  </blockquote>
  
  <p>For example, Given</p>
  
  <blockquote>
    <p>3 2 -1 2 11</p>
  </blockquote>
  
  <p>one can make this sequence a non-decreasing sequence in a <strong>4</strong> steps (Decrease 3 by 1 and increase -1 by 3). </p>
  
  <pre><code> (-1) (0) (+3) (0) (0)
  </code></pre>
  
  <p>The sequence will become </p>
  
  <pre><code>2 2 2 2 11
  </code></pre>
  
  <p>How can I solve this ?</p>