163682025-04-29 08:46:37AblablablaXorcpp17Wrong answer 0/100165ms1896 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ll t;
    cin >> t;

    while(t--){
        ll l, r;
        cin >> l >> r;

        string lent, fent;
        while(r > 0){
            lent += (char)(l % 2 + '0');
            fent += (char)(r % 2 + '0');

            l /= 2;
            r /= 2;
        }

        reverse(lent.begin(), lent.end());
        reverse(fent.begin(), fent.end());

        ll x = 0, y = 0, z = 0;
        ll ind = 0;

        for(ind = 0; ind < lent.size(); ind++){
            if(fent[ind] == '1' && lent[ind] == '1'){
                x *= 2;
                y *= 2;
                z *= 2;
                x++;
                y++;
                z++;
            } else{
                break;
            }
        }

        x *= 2;
        y *= 2;
        z *= 2;
        z++;
        ind++;

        x *= 2;
        y *= 2;
        z *= 2;
        y++;
        ind++;

        if(ind < lent.size()){
            x *= 2;
            y *= 2;
            z *= 2;
            x++;
            ind++;
        }

        while(ind < lent.size()){
            x *= 2;
            y *= 2;
            z *= 2;
            x++;
            ind++;
        }

        cout << x << " " << y << " " << z << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base0/100
1Accepted0/01ms316 KiB
2Wrong answer0/016ms316 KiB
3Wrong answer0/51ms316 KiB
4Wrong answer0/51ms316 KiB
5Wrong answer0/51ms316 KiB
6Wrong answer0/51ms316 KiB
7Wrong answer0/56ms404 KiB
8Wrong answer0/58ms316 KiB
9Wrong answer0/513ms432 KiB
10Wrong answer0/516ms480 KiB
11Wrong answer0/532ms616 KiB
12Wrong answer0/532ms564 KiB
13Wrong answer0/565ms1008 KiB
14Wrong answer0/696ms1256 KiB
15Time limit exceeded0/6128ms1588 KiB
16Time limit exceeded0/6165ms1844 KiB
17Time limit exceeded0/6165ms1744 KiB
18Wrong answer0/717ms564 KiB
19Time limit exceeded0/7157ms1844 KiB
20Time limit exceeded0/7158ms1896 KiB