Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
43301 123 【J】T2 C++ Wrong Answer 90 244 MS 248 KB 505 2026-10-28 15:07:23

Tests(9/10):


#include <bits/stdc++.h> using namespace std; typedef long long ll; ll ans; void f(ll n,ll x){ ans=0; ll c=__builtin_popcount(x); if(n<=c){ cout<<x; return; } if((n-c)%2==0 && x!=0){ ans=x+(n-c); }else{ if(x==1)ans=n+3; if(x>1)ans=x+(n-c)+1; else{ if(n==1){ cout<<-1; return; } else if(n%2==1)ans=n+3; else ans=n; } } cout<<ans<<endl; } int main(){ ll t;cin>>t; while(t--){ ll n,x; cin>>n>>x; f(n,x); } return 0; }


Judgement Protocol: