savinov's blog

By savinov, 10 years ago, In Russian

Предлагаю здесь обсудить задачи прошедшего Гран-При.

Интересно, как решать I? Мы дошли до того что, эта операция это умножение на простенькую матрицу в кольце по модулю 2. Но непонятно какой у нее период.

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

»
10 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

My approach for M: lets have priority_queue PQ where we keep people we can buy their loyalty (considering current value of M) with the key r[i]-c[i] and multiset SET where we keep people who cannot be bought in this moment with the key c[i].

Then we remove and/or move elements from these data structures greedily.

Any better solution?