Comments

was it correct initially and later system testing gave WA?

can you try using keys of one of the maps(cs for example) to iterate over as r? also try breaking when r becomes bigger than k / 2. Basically i want you to avoid unordered_set usage to see if TLE will become accepted.

I think you are copying the vector x for each indice. That could be why.

2104C - Card Game Another late comment for problem C. The following code pretty much handles the win for Alice, if she can't win, Bob will.

boolean expression

Last (card n is with Alice) and first (card 1 is with Alice) booleans are self explanatory, bobCantCounterFirstCard is false if Bob has at least one card from 2 to n — 1. beforeLastCard is true if Alice has the n — 1'th card.

There are two main situations. If Alice has the last card (1): she has to have either first card (only counter of last card) or beforeLastCard (this can be used until the first card is grabbed by Alice). If she does not have the last card (2), she has to have the first card (in order to grab the last card) and she shouldn't have any weakness before playing the first card (bobCantCounterFirstCard).

+3

This is the smallest it can get, the bottle is on the horizon!!!