I don't know if this trick was introduced or named earlier. But I found it interesting and decided to write a blog about it. The trick is simple and I wrote the blog simple too. Hope you don't get confused.
Please ignore the Chinese interface.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
I don't know if this trick was introduced or named earlier. But I found it interesting and decided to write a blog about it. The trick is simple and I wrote the blog simple too. Hope you don't get confused.
Please ignore the Chinese interface.
Название |
---|
Using
set
seems overcomplicated because you can solve the problem mentioned in the blog without set at all just keeping current minimum and delta.+1.
The author should probably specify that a set could be used if adding a 4th operation like "check membership" (i.e. checking for $$$x$$$ corrresponds to searching the set for $$$x-\delta$$$)
Yes, that would have sense with such operation.
This trick indeed has a name, it's offset. It allows adding something to all elements of a set.
I dont understand how to execute operation 1, how is the delta added to all of the elements in the set?
[1, 2, 3] + 2 = [3, 4, 5]
Venice Technique
Might be irrelevant but, Here's the same question but with Xor as an operation: For the Curious Ones!
Wow, the trick is amazing trick. Something new for me to learn today.
This trick using
set
will be more useful when there is one more query to be performed:delete element X
. Just remove element (X − δ) from theset
ortreemap
(in Java), and there you go.