# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
763715 | ivopav | Rack (eJOI19_rack) | C++14 | 1 ms | 212 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;
int main(){
long long int n;
long long int k;
cin >> n >> k;
k-=1ll;
vector<bool> bin={};
while (k>0ll){
bin.push_back(k%2);
k/=2ll;
}
while (bin.size()<n){
bin.push_back(0ll);
}
long long int rje=0ll;
reverse(bin.begin(),bin.end());
long long int sad=1ll;
for (long long int i=0;i<bin.size();i++){
if (bin[i]){
rje+=sad;
}
sad*=2ll;
}
cout << rje+1ll << "\n";
}
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... |