36362023-03-01 12:50:41norbertvidaAutókódoláscpp17Accepted 50/503ms4160 KiB
#include <bits/stdc++.h>
#define lli long long int

using namespace std;

lli N, kovval, elozoval;
int i, result;
char ch;
bool elozo[64], kov[64], nincs_elozo;

int main() {

    cin >> N;

    while(N) {
        elozo[63 - i] = kov[63 - i] = N & 1;
        N >>= 1;
        ++i;
    }

    nincs_elozo = prev_permutation(elozo, elozo + 64);
    next_permutation(kov, kov + 64);

    for(i = 0; i < 64 * nincs_elozo; ++i) {
        elozoval = (elozoval << 1) ^ elozo[i];
    }

    for(i = 0; i < 64; ++i) {
        kovval = (kovval << 1) ^ kov[i];
    }

    cout << elozoval * nincs_elozo - !nincs_elozo  << "\n" << kovval << "\n";

}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted2/23ms2328 KiB
4Accepted2/23ms2492 KiB
5Accepted2/23ms2708 KiB
6Accepted2/23ms2948 KiB
7Accepted2/23ms3128 KiB
8Accepted4/42ms3216 KiB
9Accepted4/43ms3452 KiB
10Accepted4/43ms3540 KiB
11Accepted4/43ms3556 KiB
12Accepted4/43ms3764 KiB
13Accepted4/42ms3852 KiB
14Accepted4/42ms3972 KiB
15Accepted4/42ms3880 KiB
16Accepted4/43ms4096 KiB
17Accepted4/42ms4160 KiB