aboutsummaryrefslogtreecommitdiff
path: root/codechef/XorAndMultiply/main.cpp
blob: 0d557cab22a9ba546045a4a9cab283b7c6f5a3f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    int n = 0;
    cin >> n;
    long long a, b;
    cin  >> a >> b;
    int mx = 0;
    map<int, int> mp;
    for(int i = 0; i < int(pow(2, n));i++) {
      int l = a ^ i;
      int r = b ^ i;
      mx = max(mx, l * r);
      cerr << mx << " " << i << endl;
      mp[mx] = i;
    }
    cout << mp[mx] << endl;
	}
}