cp-wiki
cp-wiki copied to clipboard
AtCoder Beginner Contest 188 Editorial
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.
once again thankyou!
Hi I cannot understand why do we need a-1 and b+1 too in problem D .
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
.
hello, i really cant understand how you are doing the last problem with bfs. can you please give a detailed explanation. thankyou!
really nice explanation for D, actually i was thinking the same way but was using other hacky implementations, b+1 technique is really nice
Such a great tutorial sir