ph2nkhang's blog

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.

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

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

long long is 8 bytes, int only 4. If you use 2^26 long longs, you get MLE.