Multiset Behaviour

Правка en1, от Deanamic_Programming, 2017-10-03 11:04:44

Hello Codeforces, I've been trying to learn how to run a DP with the convexhull optimization and I have seen this code for a line container (KTH pdf):

struct Line {
	mutable long long k, m, p;
	bool operator<(const Line& o) const {
		return Q ? p < o.p : k < o.k;
	}
};

struct LineContainer : multiset<Line> {..}

So depending in the value of Q the comparator function will do different things, how does multiset cope with this? and how does it affect the complexity of this container?

Thank you very much for the help!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Deanamic_Programming 2017-10-03 11:04:44 577 Initial revision (published)