| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1118995 | Dan4Life | Rack (eJOI19_rack) | C++17 | 1 ms | 504 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;
#define int long long
int n, k;
const int MOD = (int)1e9+7;
int poww(int a, int b){
if(!b) return 1;
int x = poww(a,b/2);
x*=x, x%=MOD;
if(b&1) x*=a, x%=MOD;
return x;
}
int32_t main(){
cin >> n >> k;
int l = 1, r = poww(2,n);
while(n--){
int mid = l+r;
if(mid%2) mid--;
mid *= poww(2,MOD-2); mid%=MOD;
if(k%2) k/=2, k++, r = mid;
else k/=2, l=(mid+1)%MOD;
}
cout << l << "\n";
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
