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

Автор insurgentes, история, 16 месяцев назад, По-английски

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

Полный текст и комментарии »

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

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

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.

Полный текст и комментарии »

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

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

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

Полный текст и комментарии »

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

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

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.me/contest/1538/problem/E

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

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

Полный текст и комментарии »

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