13462022-05-21 16:16:24nkdorka1212Autókódoláscpp11Wrong answer 40/50296ms2052 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin>>n;
    ll bits=__builtin_popcountll(n);
    for(int i=n-1;i>=1;i--)
    {
        if(__builtin_popcountll(i)==bits)
        {
            cout<<i<<" ";
            break;
        }
    }
    for(int i=n+1;i<=100000000000000;i++)
    {
        if(__builtin_popcountll(i)==bits)
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/50
1Accepted0/03ms1952 KiB
2Wrong answer0/02ms1976 KiB
3Wrong answer0/21ms1996 KiB
4Accepted2/21ms2000 KiB
5Accepted2/21ms1988 KiB
6Accepted2/21ms2000 KiB
7Accepted2/21ms1988 KiB
8Accepted4/41ms2016 KiB
9Accepted4/41ms2012 KiB
10Accepted4/41ms1996 KiB
11Accepted4/41ms2024 KiB
12Accepted4/41ms2008 KiB
13Time limit exceeded0/4296ms1140 KiB
14Accepted4/41ms2012 KiB
15Accepted4/41ms2020 KiB
16Accepted4/44ms2020 KiB
17Wrong answer0/441ms2052 KiB