2

Note 2: CF1903F

 9 months ago
source link: https://codeforces.com/blog/entry/123275
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

By yl_neo, history, 11 hours ago,

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! 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 a1,a2,...,apa1,a2,...,ap in sorted order.

Maximize min1≤i≤p−1(|ai−ai+1|)min1≤i≤p−1(|ai−ai+1|). If p=1p=1, the value would be NN.

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK