Comments

I wrote a version with comments, which should be easier to understand https://mirror.codeforces.com/contest/1987/submission/268356662 I understand this as there might be a tastiness appears later, that costs less "skip points" than the skip before, so you record all the skip happen in the previous, and keeps finding for better solution which costs less rounds for b that happens later

I have a weird WA in problem D when I add a line of code in the beginning:

if (n == k && k == 1) {cout << "! 1" << endl;continue;}

which will output the answer directly when n and k are both 1 and continue to the next testcase

following are two submitsions which only differ from the description above

https://mirror.codeforces.com/contest/1973/submission/263160320

https://mirror.codeforces.com/contest/1973/submission/263160243

Can someone teach me why, I'm new with interactive problems, thanks