Note 2: CF1903F

Revision en10, by NeoYL, 2023-12-13 13:18:40

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), which are completely solved by myself without looking at the editorial, that are both interesting and educational. If you want to motivate me to write a continuation (aka note 3), a significant upvote from you would be well appreciated!

Problem link

Problem rephrase:

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$$$.

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
Tags segment tree, 2-sat, binary search, optimization

History

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