anotherTry's blog

By anotherTry, history, 3 weeks ago, In English

I have been practicing bitsets and I have read that using a bitset is better than using a vector of bools. I attempted to solve the following problem:

https://www.codechef.com/problems/CHEFQUE

The vector of bools gave me AC but the bitset gave me a compilation error.

The code that passes:

Code that passes

The code that gives an error:

Code that gives error

Any help would be appreciated.

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

std::bitset<N> requires the size N to be a constant expression.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I tried with bitset<2147483673> bit, that gave an error as well