okay, dp is hard :( doing random codeforces