//#include <bits/stdc++.h> C++11
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <time.h>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <stack>
#include <queue>
#include <climits>
#include <map>
#include <set>
#include <sstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
vi v;
int N;
int res = 0;
void result(int n, int s)
{
int temp;
if (n == 1)
{
temp = (1 + s) % 1000000007;
v.PB(1 + s);
temp = ll(pow(2, ll(N - 1)) + 1 + s) % 1000000007;
v.PB(temp);
}
else
{
result(n - 1, s);
result(n - 1, s + pow(2, N - n));
}
}
/*int result(int index, int n, int place){
if(n==0){
return res;
}
if(log2(index)>log2(2*place+1)+n-1){
res+=res+pow(2,N-n);
return result(index,n-1,);
}
return result(index,n-1,place);
}*/
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll k;
cin >> N >> k;
//cout<<result(k,N,0)<<"\n";
result(N, 0);
/*for(int i=0;i<int(v.size());i++){
cout<<v[i]<<" ";
}*/
cout << v[k - 1] << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
10 ms |
896 KB |
Output is correct |
9 |
Correct |
25 ms |
1532 KB |
Output is correct |
10 |
Correct |
89 ms |
4588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
10 ms |
896 KB |
Output is correct |
9 |
Correct |
25 ms |
1532 KB |
Output is correct |
10 |
Correct |
89 ms |
4588 KB |
Output is correct |
11 |
Execution timed out |
1085 ms |
66448 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |