163142025-04-28 15:45:56zsomborXorcpp17Wrong answer 0/10043ms2100 KiB
#include <iostream>
using namespace std;
using ll = long long;

void solve() {
	ll l, r, a = 0, b = 0, c = 0, p = 0;
	cin >> l >> r;
	for (int i = 60; i >= 0; i--) {
		ll h = (1ll << i);
		if (!p) {
			if ((l & h) == (r & h)) {
				a += (l & h);
				b += (l & h);
				c += (l & h);
			}
			else {
				a += h;
				p = 1;
				cout << i << "\n";
			}
		}
		else {
			if (l & h) {
				a += r & h;
				b += h;
				c += h;
			}
			else {
				b += h;
				c += h - 1;
				break;
			}
		}
	}
	cout << c << " " << b << " " << a << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while (t--) solve();
}
SubtaskSumTestVerdictTimeMemory
base0/100
1Wrong answer0/01ms316 KiB
2Wrong answer0/04ms564 KiB
3Wrong answer0/51ms316 KiB
4Wrong answer0/51ms316 KiB
5Wrong answer0/51ms316 KiB
6Wrong answer0/51ms556 KiB
7Wrong answer0/52ms380 KiB
8Wrong answer0/53ms636 KiB
9Wrong answer0/54ms316 KiB
10Wrong answer0/54ms564 KiB
11Wrong answer0/58ms656 KiB
12Wrong answer0/58ms696 KiB
13Wrong answer0/517ms1084 KiB
14Wrong answer0/626ms1212 KiB
15Wrong answer0/634ms1604 KiB
16Wrong answer0/643ms2080 KiB
17Wrong answer0/641ms2056 KiB
18Wrong answer0/74ms592 KiB
19Wrong answer0/741ms2100 KiB
20Wrong answer0/741ms2100 KiB