Submission #1357430

#TimeUsernameProblemLanguageResultExecution timeMemory
1357430nasjesRack (eJOI19_rack)C++20
20 / 100
4 ms2372 KiB
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <string>
#include <cstring>
#include <iterator>
#include <random>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

typedef long double ld;
const ll dim=1e6 + 10;
const ll mod=  998244353;
const ll inf=1e18+77;
//#define endl "\n"
#define fi first
#define pb push_back
#define se second
#define vll vector<ll>

ll n, k, q;
ll a[dim];
ll cur=1;

void place(ll pos, ll j){
    a[pos]=cur;
    cur++;
    for(int i=n-1; i>j; i--){
        place(pos+(1ll<<i), i);
    }

}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll tt;
    //cin>>tt;
    tt=1;
    while(tt--){
        ll x, y;
        cin>>n>>k;
        ll m=(1<<n);
        place(1, -1);
        for(int i=1; i<=m; i++){
            if(a[i]==k){
                cout<<i<<endl;
                return 0;
            }
        }




    }

    return 0;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...