# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
237605 |
2020-06-07T17:34:25 Z |
Pbezz |
Rack (eJOI19_rack) |
C++14 |
|
5 ms |
384 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define MAXN 100005
typedef pair<int, int> pii;
ll fast(ll base, ll exp){
ll res=1;
while(exp>0){
if(exp%2==1){
exp--; res*=base;
res%=MOD;
base%=MOD;
}
if(exp==0)break;
base*=base; base%=MOD;
exp/=2;
}
return res;
}
ll solve(ll n, ll k){
if(n==1&&k==1)return 1;
if(n==1&&k==2)return 2;
ll ans = fast(2,n-1);
if(k%2==0)return solve(n-1,k/2)+ans;
else return solve(n-1,(k+1)/2);
}
int main(){
ll n,k,ans;
cin>>n>>k;
ans=solve(n,k);
if(ans<0)ans+=MOD;
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
256 KB |
Output is correct |
6 |
Correct |
4 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
256 KB |
Output is correct |
6 |
Correct |
4 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |