13452022-05-21 16:14:41nkdorka1212Autókódoláscpp11Wrong answer 40/5041ms2004 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<=n*n;i++)
    {
        if(__builtin_popcountll(i)==bits)
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/50
1Accepted0/02ms1912 KiB
2Wrong answer0/01ms1900 KiB
3Wrong answer0/21ms1928 KiB
4Accepted2/21ms1964 KiB
5Accepted2/21ms1960 KiB
6Accepted2/21ms1948 KiB
7Accepted2/21ms1948 KiB
8Accepted4/41ms1964 KiB
9Accepted4/41ms1976 KiB
10Accepted4/41ms1988 KiB
11Accepted4/41ms1976 KiB
12Accepted4/41ms1988 KiB
13Wrong answer0/41ms1972 KiB
14Accepted4/41ms2004 KiB
15Accepted4/41ms2000 KiB
16Accepted4/46ms2004 KiB
17Wrong answer0/441ms2000 KiB