Codeforces Round #587 (Div. 3) Unofficial Editorial

Revision en2, by LiM_256, 2019-09-22 06:18:48
  • A

It is easy to figure out that any $$$s[i]$$$ and $$$s[i - 1]$$$ which $$$i$$$ is even ($$$1$$$ index) must have same ammount of 'a' and 'b's. So just change it greedily.

  • B

We don't need to consider "$$$+1$$$", because it is a constant. Without it, we can sort the array undecreasing and just implement it one by one. This greedy algorithm can be proved with rearrangement inequality.

  • C

You can solve this problem intuitively, with checking each "uncovered" point by trying $$$8$$$ directions of $$$(x1, y1)$$$, which x1 is in x[1...6], y1 is in y[1...6].

  • D

It is easy to figure that $$$z$$$ must be divided by $$$abs(a[i] - a[i - 1])$$$. So $$$z$$$ will become maximum if we take $$$z$$$ as its greatest common divisior, and y will become minimum.

  • E

We can do two binary search and solve the problem easily, and check answer with simple math formula.

  • F

We can construct such DP method:


We can maintain it using simple data structure, such as segment tree. And the problem can be solved.

Tags #587, div.3, #editorial


  Rev. Lang. By When Δ Comment
en3 English LiM_256 2019-09-22 06:21:52 59
en2 English LiM_256 2019-09-22 06:18:48 5 Tiny change: 'e it greedy.\n\n<spo' -> 'e it greedily.\n\n<spo'
en1 English LiM_256 2019-09-22 06:17:56 6654 Initial revision (published)