insurgentes's blog

By insurgentes, history, 17 months ago, In English

Hi all,

Can someone help me identify the right data structure that satisfies the constraints I outlined? - Should maintain sorted order when inserting (or allow for looking up the rank and inserting in that position) - Should have efficient insertion - Should have efficient prefix sums

I think what I need is a dynamic(?) segment tree that allows insertion at arbitrary points, but unsure how I would ensure it stays balanced. Any help would be appreciated.

Some things I tried to make work

  • gnu pbds as described in this post, seemed promising but does not allow me to add in the custom prefix sum logic at each node

Full text and comments »

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

By insurgentes, history, 3 years ago, In English

Hi all, what are some good algorithms/concepts to learn to get better at graph problems? I can usually tackle most tree problems since most of them rely on some form of modified DFS/BFS, but struggle with anything beyond that.

Full text and comments »

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

By insurgentes, history, 3 years ago, In English

Hi all, I'm getting a runtime error while trying to submit my solution for 1588C - Game with Stones which I cannot replicate on the custom invocation tab or locally in vscode. Any help debugging this would be very appreciated.

My code submission: 135533102

UPDATE: I was able to edit the logic for modifying the map to get A/C but unable to see what the issue was. New submission- 135560689

Full text and comments »

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

By insurgentes, history, 3 years ago, In English

I'm getting a runtime error when i submit my code using C++ 17, but the same code is accepted for C++ 17 64 bit. I usually make all my submissions with C++17, so I'm interested in figuring out which line is causing runtime error.

Problem: https://codeforces.net/contest/1538/problem/E

RTE (C++17): https://codeforces.net/contest/1538/submission/123976702

Accepted (C++17 64bit): https://codeforces.net/contest/1538/submission/123976695

Full text and comments »

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