Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define adj_list vector<vi>
- #define endl "\n"
- #define INF_INT 2e9
- #define INF_LL 2e18
- #define matmax 25
- #define mod 1000000007
- #define mp make_pair
- #define pb push_back
- #define pi pair<int, int>
- #define pii pair<int, pair<int, int> >
- #define pl pair<ll, ll>
- #define pll pair<ll, pair<ll, ll> >
- #define vi vector<int>
- #define vl vector<ll>
- #define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
- using namespace std;
- typedef long long int ll;
- int lsone(int n)
- {
- return (n&-n);
- }
- ll pow1(ll a, ll b)
- {
- if (b == 0)
- return 1ll;
- else if (b == 1)
- return a;
- else
- {
- ll x = pow1(a, b/2);
- x *= x;
- x %= mod;
- if (b%2)
- {
- x *= a;
- x %= mod;
- }
- return x;
- }
- }
- int t;
- ll a, b;
- int main()
- {
- fastio;
- cin>>t;
- while (t--) {
- cin>>a>>b;
- ll maxxor = a ^ b, numop = 0, iter = 100, maximb = 0;
- for (ll i = 0; i <= 60; i++) {
- if (b & (1ll<<i) or (a & (1ll<<i)))
- maximb = (1ll<<i);
- }
- while (iter--) {
- if (b % 2) b = ((b - 1)/2 + maximb);
- else b /= 2;
- if ((a ^ b) > maxxor) {
- maxxor = a ^ b;
- numop = (100 - iter);
- }
- }
- cout<<numop<<" "<<maxxor<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment