peltorator's blog

By peltorator, 4 years ago, translation, In English

Hi!

I continue to make videos on algorithms. This time the topic is more basic. In this video, I talk about prefix sums and how they can help you to find sum on segments. You can also learn from this video how to easily generalize prefix sums for 2D, 3D, 4D, etc. cases. In addition, we'll also talk about a simple concept named difference array, which can easily help in some sorts of situations where it seems like you need some complex data structures. And in the end, we'll learn how to add constants, arithmetic progressions, and even quadratic functions to a segment of an array.

Link to the video

The video is in Russian but English subtitles are available. I'd be glad if you watch the video and leave a comment below with your impressions, thoughts, and ideas for future videos. You may also want to text me on telegram if you didn't understand something or you have any questions. I'll be glad to answer!

I'm sorry you need to watch it with subtitles but I'm gonna make an English channel soon. So stay tuned!

If you didn't see it already, I also have a video on disjoint sparse table: here.

Codeforces group with a contest

My realizations:

1D prefix sums

1D prefix sums with structures

2 methods for finding 2D prefix sums: one, two

1D difference array

1D difference array with structures

Full text and comments »

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

By peltorator, history, 4 years ago, translation, In English

I've never been good at solving problems about permutations. I find it really hard to illustrate and solve in mind (or on paper) even small examples. Of course, I know that it's a good idea to split a permutation into a set of cycles, but it doesn't really help! I think you understand what I'm talking about. You have these elements that are not in their original positions and you want them to be in the right places. But when you start to make swaps, you should always draw a new picture for every swap to track what's going on.

Yesterday's global round featured this problem about permutations. And it wasn't that hard, but I spent a lot of time trying to figure out what's going on. And this case is even harder because you don't only have a permutation, but also its elements are being flipped every time.

So I'd like to ask you how do you represent permutations and work with them while solving problems?

I personally found out a pretty nice way to do it yesterday. I cut cards out of paper and swapped them with my hands.

You can see that there are two cycles: 123 and 4567. And I could manually swap them and flip while swapping.

It really helped me, but it was still kinda confusing. I needed to perform the same operations several times to figure out what's going on.

I'll be glad if you share your own methods!

Full text and comments »

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

By peltorator, 4 years ago, translation, In English

Hi!

I made a video on the disjoint sparse table. It's a generalization of a sparse table that expands the possibilities of its application.

Link to the video

The video is in Russian but English subtitles are available. I'd be glad if you watch the video and leave a comment below with your impressions, thoughts, and ideas for future videos. You may also want to text me on telegram if you didn't understand something or you have any questions. I'll be glad to answer!

I'm gonna make more videos in the future. Both on basic algorithms such as prefix sums, binary search, sorting, etc., and also some advanced topics such as heavy-light decomposition, link-cut tree, lambda optimization, FFT, and so on. If you're interested, consider subscribing to my channel!

My disjoint sparse table realizations:

Easy one

Easy to use with templates

Without extending to the power of two

Codeforces group with contest

Good luck!

Full text and comments »

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

By peltorator, 6 years ago, In English

I think that rating(all) tab on codeforces doesn't work. There is no difference between "rating" and "rating (all)" tabs. But for example there is ershov.stanislav who should be in the top on "rating (all)" tab.

Full text and comments »

Tags bug
  • Vote: I like it
  • +47
  • Vote: I do not like it

By peltorator, 6 years ago, In English

A few days ago 300iq wrote in the blog that he'll dye his hair pink for a week if he doesn't become a legendary grandmaster before the new year. But he has already become a legendary grandmaster((( Actually we have one more chance! If we get 300 iq likes under this post 300iq WILL dye his hair pink! Let's do it together.

Full text and comments »

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