//don't copy pls)
/*TAAK ZDES NADO RECURSIU PISAT*/
//I'm not in the danger i am the DANGER
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define sigma signed
using namespace std;
using namespace __gnu_pbds;
const int N = 1e6 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,k,ans[21][N];
void Gold(){
cin >> n >> k;
vector <int> q;
q.clear();
q.pb(1);
for(int i = 1 ; i <= n ; i++){
vector <int> nq;
nq.clear();
for(auto it : q){
nq.pb(it);
nq.pb(it + (1 << (i - 1)));
}
q = nq;
}
cout << q[k - 1];
}
sigma main(){
//freopen("txt.in","r",stdin);
//freopen("txt.out","w",stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
srand(time(0));
int TT = 1;
// cin >> TT;
for(int i = 1 ; i <= TT ; i++){
//cout << "Case " << i << ": ";
Gold();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
1748 KB |
Output is correct |
9 |
Correct |
6 ms |
5708 KB |
Output is correct |
10 |
Correct |
24 ms |
21132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
1748 KB |
Output is correct |
9 |
Correct |
6 ms |
5708 KB |
Output is correct |
10 |
Correct |
24 ms |
21132 KB |
Output is correct |
11 |
Runtime error |
164 ms |
102400 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |