shezitt's blog

By shezitt, 10 months ago, In English

I think that many people cheated while solving 1918C - XOR-distance in the recent round Codeforces Round 922 (Div. 2).

All the following codes are quite similar to this code:

     ll a,b,c; cin>>a>>b>>c;
     if(a<b) swap(a,b);
     ll ans = a-b, cnt=0, mn=ans;
     for(int i=60; i>=0; i--){
        if(((b>>i)&1)==0 && ((a>>i)&1)==1 && cnt+(1ll<<i)<=c){
            if(ans>=2*(1ll<<i)){
                cnt+=(1ll<<i);
                ans-=2*(1ll<<i);
 
            }
            else{
                mn = min(mn,2*(1ll<<i)-ans);
            }
        }
 
     }
     cout<<min(ans,mn)<<endl;

244142307

I found some codes which are pretty similar:

These are just a few, but there are many more. I imagine that the code was published somewhere and everyone copied from there, but I couldn't find the source (if anyone finds it, please comment).

Full text and comments »

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