Can anyone please help me figure out what is wrong with my solution?
Problem: https://www.spoj.com/problems/CONSEC/ My solution: https://ideone.com/zXToOA Verdict: WA
I used DSU and processed the queries in reversed order. So, basically I started with the string after the characters of the string were replaced by the '#' character. For query of type 1 i, I stored the current maximum for that character to be printed later on and for query of type 2 i, I tried to incorporate this character with the remaining set and updated the maximum for this character.