IUPC- PLINTH’20: https://www.codechef.com/PLIN2020/problems/PJCYP
PROBLEM: There were N wooden planks kept in a row (The height of the ith plank is greater than or equal to the height of the previous plank). At every turn a player will select a number (height of the plank), if there are multiple occurrences of that plank then the first one among them and all the planks before it (index wise) are removed. The player who removes the last plank will be declared as the winner.
In this game, the winner is decided only by counting the frequency of distinct heights of the planks and if there are odd number of planks of any height then Customer-A wins and otherwise B, because when they play optimally then A will try to select the plank whose frequency is odd so that he may remove the last plank and win the game.
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define FastIo ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
for(auto it : mp)