/// chmax, chmin sugar syntax pub trait Change { fn chmax(&mut self, x: Self) -> bool; fn chmin(&mut self, x: Self) -> bool; } impl Change for T { fn chmax(&mut self, x: T) -> bool { if *self < x { *self = x; true } else { false } } fn chmin(&mut self, x: T) -> bool { if *self > x { *self = x; true } else { false } } }