# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
999796 |
2024-06-16T06:59:40 Z |
vjudge1 |
Rack (eJOI19_rack) |
C++17 |
|
3 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll unsigned long long
ll binpow(ll a, ll b){
ll res = 1;
while(b != 0){
if (b % 2 == 0){
b /= 2;
a *= a;
a %= mod;
}
else{
b--;
res *= a;
res %= mod;
}
}
return res;
}
ll f(ll n, ll k, ll va){
va %= mod;
ll ans = 0;
if (n == 0){
return 0;
}
if (n <= 63){
ll ag = pow(2ull, n - 1);
if (ag < k){
ans += va;
ans += f(n - 1, k - ag, va * 2);
return ans;
}
}
ans += f(n - 1, k, va * 2);
return ans;
}
int main(){
ll n, k;
cin>>n>>k;
cout<<(f(n, k, 1) + 1) % mod;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
3 ms |
348 KB |
Output is correct |