Note 2: Codeforces 912 Div 2 F [Medium]

Правка en35, от NeoYL, 2023-12-31 12:36:56

This is my personal note and might be some kind of user editorial/learning material for some people!

This is the second episode of this "note" series. I will write notes on problems (normally around 2400-ish problems), that are both interesting and educational. I normally will spend a few hours on each problem so please be patient when reading the blog. The problem on these notes should give a very interesting solution and will likely be optimizations problems (I feel like these problems have an IOI-style, which requires you to find some incomplete solution first then find the final solution using it).

If you want to motivate me to write a continuation (aka note 3), a significant upvote from you would be well appreciated! If I received lots of downvotes (because I'm also spending a lot of time to write this and to learn latex only to express my ideas accurately to you guys), I'm probably not gonna continuing writing these blogs.

Problem link

Problem summary:

Given a set of edges connecting two nodes, we must take at least one node from each edge's end.

Let the taken nodes to be $$$a_{1}, a_{2}, ..., a_{p}$$$ in sorted order.

Maximize $$$\min_{1 \leq i \leq p-1}(|a_{i}-a_{i+1}|)$$$. If $$$p=1$$$, the value would be $$$N$$$.

Again, attempt the problem yourself before continue reading this blog.

Prerequisites
If you don't know the second tag in the Prerequisites
first observation
second observation
optimization

AC code

Code

Comment on this problem and my feelings:

Feelings

Tips for implementation:

Tips

Hope you guys learnt something from this blog.

Теги segment tree, 2-sat, binary search, optimization

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en37 Английский NeoYL 2024-11-03 19:14:49 9 Tiny change: ' two nodes, we must t' -> ' two nodes each, and we must t'
en36 Английский NeoYL 2024-11-03 19:13:25 8
en35 Английский NeoYL 2023-12-31 12:36:56 75
en34 Английский NeoYL 2023-12-17 09:21:24 1 Tiny change: 'ng it). \n\nIf you w' -> 'ng it). \n \nIf you w'
en33 Английский NeoYL 2023-12-15 06:13:39 83
en32 Английский NeoYL 2023-12-14 19:33:45 18
en31 Английский NeoYL 2023-12-14 19:32:47 112
en30 Английский NeoYL 2023-12-14 19:29:59 258
en29 Английский NeoYL 2023-12-14 13:27:43 4
en28 Английский NeoYL 2023-12-14 12:50:28 9 Tiny change: 'ry search problems from [use' -> 'ry search from [use'
en27 Английский NeoYL 2023-12-14 09:02:38 12
en26 Английский NeoYL 2023-12-14 09:02:07 11
en25 Английский NeoYL 2023-12-14 09:01:38 153
en24 Английский NeoYL 2023-12-13 20:10:47 3 Tiny change: 's to just read on 2' -> 's to just to read on 2'
en23 Английский NeoYL 2023-12-13 20:09:51 4
en22 Английский NeoYL 2023-12-13 15:42:51 42
en21 Английский NeoYL 2023-12-13 14:58:05 8
en20 Английский NeoYL 2023-12-13 14:36:33 67
en19 Английский NeoYL 2023-12-13 14:25:57 144
en18 Английский NeoYL 2023-12-13 14:01:23 75
en17 Английский NeoYL 2023-12-13 13:27:24 0 (published)
en16 Английский NeoYL 2023-12-13 13:27:15 12
en15 Английский NeoYL 2023-12-13 13:23:28 19
en14 Английский NeoYL 2023-12-13 13:23:03 6
en13 Английский NeoYL 2023-12-13 13:22:08 8 Tiny change: 'e r = mid — 1;\n }' -> 'e r = mid - 1;\n }'
en12 Английский NeoYL 2023-12-13 13:21:20 1
en11 Английский NeoYL 2023-12-13 13:21:09 672
en10 Английский NeoYL 2023-12-13 13:18:40 283
en9 Английский NeoYL 2023-12-13 13:09:12 13
en8 Английский NeoYL 2023-12-13 13:08:27 18
en7 Английский NeoYL 2023-12-13 13:07:55 72
en6 Английский NeoYL 2023-12-13 13:06:49 32
en5 Английский NeoYL 2023-12-13 13:05:56 58
en4 Английский NeoYL 2023-12-13 13:03:49 0
en3 Английский NeoYL 2023-12-13 13:03:47 4697
en2 Английский NeoYL 2023-12-13 12:51:33 24
en1 Английский NeoYL 2023-12-13 12:50:50 4437 Initial revision (saved to drafts)