Submission #1090907

# Submission time Handle Problem Language Result Execution time Memory
1090907 2024-09-19T06:27:48 Z Muhammet Rack (eJOI19_rack) C++17
100 / 100
100 ms 604 KB
#include <bits/stdc++.h>

using namespace std;

const long long M = (1e9 + 7);

long long n, k, ans;

void f(long long x, long long l, int y){
	if(y == -1){
		ans = l;
		return;
	}
	if(x % 2 == 0){
		long long z = 1;
		for(int i = 0; i < y; i++){
			z *= 2;
			z %= M;
		}
		l += z;
		l %= M;
	}
	if(x >= 2) x++, x /= 2;
	f(x,l,y-1);
}

int main(){
	cin >> n >> k;
	f(k,1,n-1);
	ans %= M;
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 352 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 352 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 352 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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 352 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 8 ms 344 KB Output is correct
15 Correct 100 ms 352 KB Output is correct