Editorial of Educational Codeforces Round 2

Revision en6, by Edvard, 2015-12-20 01:04:40

This round was unusual: some of problems was prepared by students and employees of Saratov State U for some of past olympiads and one of problems was prepared by dalex for Codeforces regular round but was not used there.

609A - USB Flash Drives

Let's sort the array in nonincreasing order. Now the answer is some of the first flash-drives. Let's iterate over array from left to right until the moment when we will have the sum at least m. The number of elements we took is the answer to the problem.

Complexity: O(nlogn).

609B - The Best Gift

Let's denote cnti — the number of books of i th genre. The answer to the problem is equals to . In first sum we are calculating the number of good pairs, while in second we are subtracting the number of bad pairs from the number of all pairs.

Complexity: O(n + m2) or O(n + m).

609C - Load Balancing

Denote s — the sum of elements in array. If s is divisible by n then the balanced array consists of n elements . In this case the difference between maximal and minimal elements is 0. Easy to see that in any other case the answer is greater than 0. On the other hand the array consists of numbers and numbers is balanced with the difference equals to 1. Let's denote this balanced array b. To get array b let's sort array a in nonincreasing order and match element ai to element bi. Now we should increase some elements and decrease others. In one operation we can increase some element and decrease another, so the answer is .

Complexity: O(nlogn).

609D - Gadgets for dollars and pounds

TODO

609E - Minimum spanning tree for each edge

TODO

609F - Frogs and mosquitoes

TODO

Tags education round 2, editorial

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English Edvard 2015-12-20 01:06:01 7190 Reverted to en5
en6 English Edvard 2015-12-20 01:04:40 7190 Tiny change: 'oks of $i$th genre. ' -
ru12 Russian Edvard 2015-11-28 02:56:22 58
en5 English Edvard 2015-11-28 02:55:31 1179
en4 English Edvard 2015-11-28 01:56:48 12 Tiny change: 'l to large``. There is' -> 'l to large''. There is'
en3 English Edvard 2015-11-28 01:56:19 14 Tiny change: 'l to large``. There is' -> 'l to large''. There is'
en2 English Edvard 2015-11-28 01:33:31 1343
en1 English Edvard 2015-11-28 00:38:09 2786 Initial revision for English translation
ru11 Russian Edvard 2015-11-27 23:53:58 9
ru10 Russian Edvard 2015-11-27 23:50:23 9 Мелкая правка: 'чение $d$ —- наибольш' -> 'чение $d$ --- наибольш'
ru9 Russian Edvard 2015-11-27 23:29:29 1188
ru8 Russian Edvard 2015-11-27 20:04:30 63
ru7 Russian Edvard 2015-11-27 20:03:57 104 (опубликовано)
ru6 Russian Edvard 2015-11-27 19:54:54 51
ru5 Russian Edvard 2015-11-27 19:53:17 24
ru4 Russian Edvard 2015-11-27 19:52:37 197 Мелкая правка: ' to large`). Давайт' -
ru3 Russian Edvard 2015-11-27 19:48:36 1406
ru2 Russian Edvard 2015-11-27 19:25:41 1280
ru1 Russian Edvard 2015-11-27 19:05:18 1827 Первая редакция (сохранено в черновиках)