Submission #1172711

#TimeUsernameProblemLanguageResultExecution timeMemory
1172711ezzzayRack (eJOI19_rack)C++20
0 / 100
0 ms392 KiB
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
const int N=1e5;
vector<int>v;
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    int x=1;
    int h=0;
    while(1){
        v.pb(x);
        if(h== (1<< (n-1)))break;
        h++;
        x+= ( 1<<(n-1));
        v.pb(x);
        h++;
        if(h== (1<< (n-1)))break;
        x-= (1<< (n-2));
    }
    x=2;
    h=0;
    while(1){
        v.pb(x);
        if(h== (1<< (n-1)))break;
        h++;
        x+= ( 1<<(n-1));
        v.pb(x);
        h++;
        if(h== (1<< (n-1)))break;
        x-= (1<< (n-2));
    }
    for(int i=0;i<v.size();i++){
        if(v[i]==k){
            cout<<i+1;
        }
    }
    
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...