# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284427 | lukameladze | Rack (eJOI19_rack) | C++14 | 135 ms | 102404 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
# include <bits/stdc++.h>
using namespace std;
long long n,k,pw[1000005],x,ww;
vector <long long> v;
int main()
{
cin>>n>>k;
pw[0]=1;
for (int i=1; i<=n; i++)
pw[i]=pw[i-1]*2;
v.push_back(1);
v.push_back(pw[n-1]+1);
x=(n-1);
if (k<=2)
{
cout<<v[k-1]<<endl;
return 0;
}
while (true)
{
x--;
ww=v.size();
for (int i=0; i<ww; i++)
{
v.push_back(v[i]+pw[x]);
// cout<<v[i]<<" "<<pw[x]<<endl;
}
if (v.size()>=k) break;
}
cout<<v[k-1]<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |