50pts and 100pts, just because of different ways of writing

I was working on this https://www.codechef.com/status/MAXAND18 and wrote the first solution as this(1st) and passed with 50 pts.

I wrote another solution as this(2nd). Surprisingly, this passed with 100 pts. The only difference was on line 60 and 67, where I just changed:
(1<<i) -> i on line 60 and,
res[i].second -> (1<<res[i].second) on line 67.

I would be thankful if anyone could provide a reason for this, so to avoid such silly mistakes in further submissions.

Try with 1ll<<i, it will be AC. This happened becuse 1<<i leads to overflow for i=32 (most probably, seee the limit for int). If you convert it into long then it will be in limit

1 Like

you were lucky that one of them get accepted. (1<<i) will overflow for i greater than 30.

You should use (1LL<<i) instead

1 Like

on line 60, (1<<i) will overflow for i greater than 30 whereas on line 67 we need to restrict the overflow value.

Yes, Noted it. Thanks everyone for pointing it out