Need help on a DSU problem

Revision en1, by Tobby_And_Friends, 2019-10-10 20:13:02

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Tobby_And_Friends 2019-10-10 20:13:02 593 Initial revision (published)