75952024-01-10 00:28:01rennAutókódoláscpp14Wrong answer 29/503ms3652 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {

    long long nagy, kicsi, j = -1, h = -1;
    cin >> nagy;

    kicsi = nagy;

    bool prev = true, most = true;
    for(long long i = 0; i < 41; i++) {
        prev = most;
        most = (kicsi & (1LL << i));

        if(most && !prev) {
            kicsi <<= 1;
            kicsi ^= (1LL << (i+1LL));
            kicsi ^= (1LL << (i-1LL));
            h = 0;
            break;
        }
    }

    prev = most = false;
    for(long long i = 0, k; i < 41; i++) {
        prev = most;
        most = (nagy & (1LL << i));

        j += most;

        nagy ^= ((long long)most << i);
        if(!most && prev) {
            nagy ^= (1LL << i);

            for(k = 0; k < j; k++) {
                nagy ^= (1LL << k);
            }
            break;
        }
    }
    cout << (h < 0 ? h : kicsi) << "\n";
    cout << nagy << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base29/50
1Wrong answer0/03ms1880 KiB
2Accepted0/03ms2064 KiB
3Accepted2/23ms2428 KiB
4Accepted2/23ms2520 KiB
5Partially correct1/23ms2664 KiB
6Partially correct1/23ms2996 KiB
7Partially correct1/23ms3040 KiB
8Partially correct2/43ms3016 KiB
9Partially correct2/43ms3220 KiB
10Partially correct2/42ms3224 KiB
11Partially correct2/42ms3224 KiB
12Partially correct2/42ms3220 KiB
13Accepted4/42ms3160 KiB
14Partially correct2/42ms3160 KiB
15Partially correct2/43ms3356 KiB
16Partially correct2/43ms3568 KiB
17Partially correct2/43ms3652 KiB