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

Автор determinism, 9 лет назад, По-английски

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?

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

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

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.