https://www.codechef.com/viewsolution/36968659
Here is my AC submission to the problem
using bitsets.
My doubt is this :Why is my code NOT giving MEMORY LIMIT EXCEEDED?
Looking at the constraints ,my code should be using 4*(1e3)*(N) bits of memory.(where N<=1e5).
but the memory limit allowed is only 8*(1e4)*8 bits.
This is not the memory limit for execution but the maximum size of source code allowed. In fact no code can run in 80 KB memory. Usually codes below 512 MB run successfully and your code is using 111 MB.
Oh ok. Thanks a lot. So that means that I can create a bitset of size one billion .right?
Not sure about 1 billion but a bitset 108 bits works for sure. I have even seen AC codes consuming 1000+ MB memory.