TLE on Problem 365A, "Knight Tournament"

Revision en1, by SAT2020, 2022-07-03 07:13:10

Hello Codeforces friends,

I am currently befuddled by a TLE I received on Problem 365A, "Knight Tournament". Essentially, the problem provides the user with a series of range queries, Each range query represents a set of "knights" that participated in a "tournament round", with a "winning knight" conquering every other knight in the range. The problem asks the user to spit out a list of the conquerers of each knight. The critical difficulty is that multiple queries might have overlapping ranges. My solution was to keep a constantly updating set of knights in the tournament. Each time a knight was conquered, I'd remove them from the set. Unfortunately, while my solution passed the correctness tests, I got a TLE on test #11. Could anyone please tell me what I did wrong?

You can find my code here: https://codeforces.me/contest/356/submission/162602701

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English SAT2020 2022-07-03 07:13:10 911 Initial revision (published)