123gjweq2's blog

By 123gjweq2, history, 2 months ago, In English

It looks like Rust doesn't have bitset in its std. Is there any alternative?

  • Vote: I like it
  • -5
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Yes, you can write your own implementation.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Egor has a contest library which includes bitset. https://github.com/EgorKulikov/rust_algo/blob/master/algo_lib/src/collections/bit_set.rs

At a glance it's not exactly the same (e.g. size is set at runtime) but may be good for your purposes.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The rust king himself. Thanks broski. This might be a dumb question, but can I just copy-paste this into my code when I need to?

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Codeforces and most other platforms allow you to copy code if it's public before the contest starts.

      With this particular library, it can be tricky because files often import other files in the library. The author uses an automated tool to splice together a file for submission. So it would probably be best for you to prepare a working version beforehand (or learn to use the library+tool).

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I thought about bitset too, but in 3 months of solving ~2000-2400 problems, I haven't found a problem that you can't solve without it. The same with multiset.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hey you 123gjweq2 iam talking