CODEVS 1219 (easy dp)