ph2nkhang's blog

By ph2nkhang, history, 10 months ago, In English

I just found out about bitsets yesterday and tried using it. Fumbling around with it for while and I realized that it is just a bool array, but more operations built-in. I thought the size would be the limit since C++ only stores a value upto 64-bit. BUT NO, I tried craking the size way up and it works just as well as any array. That and offering every other BITWISE operations. Then I thought this might be too good to be true. So what is the difference really? Is it safe to just ditch bool arrays entirely and switch to bitsets or is there a tradeoff?

Full text and comments »

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

By ph2nkhang, history, 12 months ago, In English

(First of pardon my English)

So I was today years old when I found out that the data type can somehow affect the way the program handles bit-wise operations? I mean to me it doesn't really make sense, if they're all just an integer type why does the size even matter?

This is what I bumped into:

Problem: https://marisaoj.com/problem/523 In short you are given n strings, count the number of subsets of strings that contains all letters of the alphabet.

Here is the code that returns runtime error: https://ideone.com/KEAK8L Here is the code that gets accepted: https://ideone.com/ymz85I

The only difference is declaring my variables as int or as long long type.

If someone can, PLEASE explain it to me, I find this very confusing.

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By ph2nkhang, history, 15 months ago, In English

hi, I just want to ask why does Codeforces occasionally roll-back your ratings for the last few rounds? I've been through this before and din't mind much. But now I'm just curious what is going on behind the curtains.

Btw: jiangly is back on 4000+ for a few hours :)

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it