35092023-02-28 14:24:52AblablablaAutókódoláscpp17Wrong answer 18/503ms3952 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int n;
    cin >> n;
    long long int eredeti = n;
    vector<int> alap(64, 0);
    vector<int> kis(64, 0);
    vector<int> nagy(64, 0);
    bool elsok = true;
    bool elson = true;
    long long int a;
    long long int b;
    int i = 63;
    long long int kettoH = 1;
    while(i >= 0){
        alap[i] = n % 2;
        n /= 2;
        kettoH *= 2;
        if(elson && alap[i] == 0 && alap[i + 1] == 1){
            a = kettoH / 4;
            elson = false;
        }

        if(elsok && alap[i] == 1 && alap[i + 1] == 0){
            b = kettoH / 4;
            elsok = false;
        }

        if(!elson && !elsok){
            break;
        }
        i--;
    }


    cout << eredeti - b << "\n" << a << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Wrong answer0/03ms1812 KiB
2Wrong answer0/03ms2056 KiB
3Wrong answer0/23ms2268 KiB
4Partially correct1/23ms2480 KiB
5Wrong answer0/23ms2540 KiB
6Wrong answer0/23ms2748 KiB
7Partially correct1/23ms2956 KiB
8Partially correct2/43ms3308 KiB
9Wrong answer0/43ms3388 KiB
10Partially correct2/43ms3528 KiB
11Partially correct2/43ms3864 KiB
12Partially correct2/43ms3832 KiB
13Wrong answer0/42ms3828 KiB
14Partially correct2/43ms3948 KiB
15Partially correct2/43ms3832 KiB
16Partially correct2/43ms3828 KiB
17Partially correct2/43ms3952 KiB