zzzzsust19's blog

By zzzzsust19, history, 2 years ago, In English

This is my submission 184446767 The problem link: https://codeforces.net/problemset/problem/1620/E

At first I thought I was getting MLE for using maps, then I used vector for mapping the elements of list. Not to mention, the number of elements in which test case I am getting MLE is surprisingly small. It's only 1000 * 2 items in array at most.

Now, I created a separate vector to store queries, it's a 2d vector. I am using first dimension to store the index where the query starts. The second dimension implies the number of queries in that index. This is the only thing that looks sus to me. Otherwise I don't get the cause of MLE

  • Vote: I like it
  • +4
  • Vote: I do not like it

»
2 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

bruh, write readable code before asking for help.

»
2 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

184523688 Here is the improved version of this code. It's slightly more readable than my previous submission. I used a single dimensional vector instead of the 2d vector that I used for storing queries. There is no more TLE or MLE. It is still getting wrong answer though. My guess is that maybe I was getting MLE because of infinite recursion. As I used DSU, in some cases parent finding method fell into an infinite loop. Which is probably the cause of MLE

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I can't see why I am getting WA, anybody got any clue?