#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,X[500005],x;
vector <long long> v;
int main() {
cin>>n>>k;
X[0]=1;
for(long long i=1;i<=n;i++) {
X[i]=X[i-1]*2;
}
if(k==1) { cout<<1; return 0; }
v.push_back(1);
x=n;
while(true) {
x--;
a=v.size();
for(long long i=0;i<a;i++) {
v.push_back(v[i]+X[x]);
}
if(v.size()>=k) break;
}
cout<<v[k-1];
}
Compilation message
rack.cpp: In function 'int main()':
rack.cpp:20:20: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
20 | if(v.size()>=k) break;
| ~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
1020 KB |
Output is correct |
9 |
Correct |
3 ms |
2548 KB |
Output is correct |
10 |
Correct |
4 ms |
2548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
1020 KB |
Output is correct |
9 |
Correct |
3 ms |
2548 KB |
Output is correct |
10 |
Correct |
4 ms |
2548 KB |
Output is correct |
11 |
Runtime error |
130 ms |
102404 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |