# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
638738 |
2022-09-07T08:43:36 Z |
Koful123 |
Rack (eJOI19_rack) |
C++17 |
|
8 ms |
8148 KB |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int N = 1e6+6;
int pw[N];
int f(int n,int k){
if(n == 0) return 1;
if(k % 2) return f(n-1,k/2+1);
return pw[n-1] + f(n-1,k/2);
}
void solve(){
int n,k;
cin >> n >> k;
pw[0] = 1;
for(int i=1;i<N;i++){
pw[i] = (pw[i-1] * 2) % mod;
}
cout << f(n,k) << endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--)
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8020 KB |
Output is correct |
2 |
Correct |
7 ms |
8020 KB |
Output is correct |
3 |
Correct |
7 ms |
8136 KB |
Output is correct |
4 |
Correct |
7 ms |
8032 KB |
Output is correct |
5 |
Correct |
7 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8020 KB |
Output is correct |
2 |
Correct |
7 ms |
8020 KB |
Output is correct |
3 |
Correct |
7 ms |
8136 KB |
Output is correct |
4 |
Correct |
7 ms |
8032 KB |
Output is correct |
5 |
Correct |
7 ms |
8148 KB |
Output is correct |
6 |
Correct |
7 ms |
8140 KB |
Output is correct |
7 |
Correct |
8 ms |
8136 KB |
Output is correct |
8 |
Correct |
7 ms |
8108 KB |
Output is correct |
9 |
Correct |
7 ms |
8132 KB |
Output is correct |
10 |
Correct |
8 ms |
8136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8020 KB |
Output is correct |
2 |
Correct |
7 ms |
8020 KB |
Output is correct |
3 |
Correct |
7 ms |
8136 KB |
Output is correct |
4 |
Correct |
7 ms |
8032 KB |
Output is correct |
5 |
Correct |
7 ms |
8148 KB |
Output is correct |
6 |
Correct |
7 ms |
8140 KB |
Output is correct |
7 |
Correct |
8 ms |
8136 KB |
Output is correct |
8 |
Correct |
7 ms |
8108 KB |
Output is correct |
9 |
Correct |
7 ms |
8132 KB |
Output is correct |
10 |
Correct |
8 ms |
8136 KB |
Output is correct |
11 |
Incorrect |
7 ms |
8128 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |