# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314392 | urosk | Rack (eJOI19_rack) | C++14 | 135 ms | 376 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>
#include <chrono>
#define ll long long
#define ull unsigned long long
#define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf 1e15
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
using namespace std;
using namespace std::chrono;
/*auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout << "Time taken by function: "
<< duration.count() << " microseconds" << endl;*/
ll mod = 1e9+7;
int main(){
int n;
ll k;
cin >> n >> k;
ll ans = 0;
ll g;
for(int i = n;i>=1;i--){
if(k%2==0){
g = 1;
for(int j = 0;j<i-1;j++){
g*=2;
g%=mod;
}
ans+=g;
ans%=mod;
}
k=(k+1)/2;
}
ans++;
ans%=mod;
cout<<ans;
}
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... |