Блог пользователя zzzzsust19

Автор zzzzsust19, история, 2 года назад, По-английски

This is my submission 184446767 The problem link: https://mirror.codeforces.com/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

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
2 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

bruh, write readable code before asking for help.

»
2 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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