제출 #1287435

#제출 시각아이디문제언어결과실행 시간메모리
1287435JohanRack (eJOI19_rack)C++20
0 / 100
1 ms576 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int INF=1e18;
#define no "NO"
#define yes "YES"
#define pb push_back
void solve(){
  int n;
  cin>>n;
  int x;
  cin>>x;
  if(x<=pow(2,n)/2){
    if(x%2==1){
      cout<<x;
    }
    else{
      cout<<x+pow(2,n-1)-1;
    }
  }
  else{
    if(x%2==0){
      cout<<x;
    }
    else{
      cout<<x-pow(2,n-1)+1;
    }
  }
}
/** 
 *(1  2)
 * 1 17 1 2
 * 3 19 3 4
 * 5 21 5 6
 * 7 23 7 8
 * 9 25 9 10
 * 11 27 11 12
 * 13 29 13 14
 * 15 31 15 16
 * 
 * 
 * 2 18 17 18
 * 4 20 19 20
 * 6 22 21 22
 * 8 24 23 24
 * 10 26 25 26 
 * 12 28 27 28
 * 14 30 29 30
 * 16 32 31 32
 */
signed main(){
  int t=1;//cin>>t;
  while(t--){
    solve();
    cout<<endl;
  }
}//
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...