MeGaGOd's blog

By MeGaGOd, history, 5 weeks ago, In English

I am trying to do this problem on CSES : Link

I have done SOS dp and it's correct for type 1 and type 2 but WA on type 3

In type i try to count the number of value cnt which x&y == 0 then the desired answer must be n — cnt

I don't know why my approach is wrong, Can somebody point me out ?

Here's my code : Link

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

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

Auto comment: topic has been updated by MeGaGOd (previous revision, new revision, compare).

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

Auto comment: topic has been updated by MeGaGOd (previous revision, new revision, compare).

»
5 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

res3[x] == n - res1[~x]