yimao's blog

By yimao, 13 years ago, In English

Codeforces Round #112 (Div. 2) the problem: http://www.codeforces.com/contest/165/problem/E

the problem E on #112 Div.2:
Compatible Numbers " Two integers x and y are compatible, if the result of their bitwise "AND" equals zero, that is, a & b = 0. For example, numbers 90 (10110102) and 36 (1001002) are compatible, as 10110102 & 1001002 = 02…… "

I have try a solution for building a digit tree. for example: 3 2 3 6 then we get : 10, 11, 110, then I could use the word "01","11","011" to build a dictionary-like tree. I think it could solve the problem.

I had approve all the data where given and some data  I had set. Unfortunately, when I summit,  it return wrong answer on the data 1 and displayd my first answer is "0 0". I got confused for that.


Then I had test the data @www.idecom.com but it return the "0 0", too. My system is Ubuntu 10.04,and the IDE is Codeblocks.  I also had test the data on Windows 7 ,the IDE are Codeblocks and Dev C++, it returned another strange data.


I need some help. Thank you very much!
The code( I had write some note ) :     http://www.codeforces.com/contest/165/submission/1381741
Sorry for my bad English.
Thank you!
  • Vote: I like it
  • -5
  • Vote: I do not like it