# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
280257 | antontsiorvas | Rack (eJOI19_rack) | C++14 | 6 ms | 416 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 <cstdio>
int ans[1000005];
void f(int n, long long int coats){
if(n == 0 || coats == 1) return;
if(coats%2) ans[n] = 1;
else ans[n] = 2;
return f(n-1,coats-coats/2);
}
int main(){
int N, MOD = 1000000007;
long long int K, pos=1, jump=1;
scanf("%d%lld",&N,&K);
f(N,K);
for(int i=1; i<=N; i++){
if(ans[i] == 2) pos += jump;
pos %= MOD;
jump %= MOD;
jump *= 2;
}
printf("%lld",pos);
}
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... |