lucifer1004 / cp-wiki

lucifer1004 的 CP 笔记
https://cp-wiki.vercel.app
131 stars 14 forks source link

AtCoder Beginner Contest 188 Editorial #26

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

AtCoder Beginner Contest 188 Editorial | CP Wiki

Find the maximum of the lower half and the upper half, and compare them. The index of the smaller value is the answer we need.

https://cp-wiki.vercel.app/en/tutorial/atcoder/ABC188/

Adityakrmishra1 commented 3 years ago

once again thankyou!

too-rusty commented 3 years ago

Hi I cannot understand why do we need a-1 and b+1 too in problem D .

lucifer1004 commented 3 years ago

Hi I cannot understand why do we need a-1 and b+1 too in problem D.

Actually what we do need is a and b+1. a-1 and b are unnecessary. I will update my editorial and code.

Suppose we have [1,6] and [4,9]. The intersection of these two intervals will make three non-overlapping segments: [1,3], [4,6] and [7,9] (and there is supposed to be a virtual segment [10,inf]). To make these final segments, we would need the start of each segment, and in this case, the starts are 1, 4, 7, 10, which all come from a and b+1.

srthkhny1 commented 3 years ago

hello, i really cant understand how you are doing the last problem with bfs. can you please give a detailed explanation. thankyou!

too-rusty commented 3 years ago

really nice explanation for D, actually i was thinking the same way but was using other hacky implementations, b+1 technique is really nice

kabbo25 commented 3 years ago

Such a great tutorial sir