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 | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
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.