determinism's blog

By determinism, 10 years ago, In English

I solved this question with a solution like this, but the problem is that my solution's memory complexity is a lot. It used something like 250 MBs. Is my approach to problem wrong? If there is a better way to do it, what is it?

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

9357007 — it's your code with set of tuple<int, int, int> instead 2d-array of sets. Only 40 MB. PS: Set costs so much, because it has many internal pointers and variables. You should "link" the "data" when you can (for instance — pair of ints instead [int][int]) and create as less as possible containers.