title: Queries for cyclic proportional assignment of work to hosts
body: <p>Consider <code>M</code> pieces of work distributed over <code>N</code> hosts in a cyclic way where each host must get the amount of work proportional to its speed. Without proportions, this is implemented as:</p>
  <pre><code>int64_t AssignWorkToHost(const int64_t i_work) {
    return i_work % N;
  }
  </code></pre>
  <p>Proportions are weights <code>p[i]</code> that sum up to <code>1.0</code>, so that <code>i</code>-th host must get more or less <code>p[i]*M</code> pieces of work.</p>
  <p><code>M</code> is so large that storing <code>M</code> values doesn't fit in the memory of a single host (but a solution where it fits would be of interest too). <code>N</code> can be as large as 10 000. Ideally each host must store no more than <code>O(M/N)</code> values and the computational complexity of <code>AssignWorkToHost()</code> should be no more than <code>O(N)</code>. Preprocessing is fine. The algorithm should be deterministic, meaning that each process within the distributed group must get the same assignment of work to hosts.</p>