Submission #1118995

# Submission time Handle Problem Language Result Execution time Memory
1118995 2024-11-26T13:00:50 Z Dan4Life Rack (eJOI19_rack) C++17
40 / 100
1 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, k;
const int MOD = (int)1e9+7;
int poww(int a, int b){
	if(!b) return 1;
	int x = poww(a,b/2);
	x*=x, x%=MOD;
	if(b&1) x*=a, x%=MOD;
	return x;
}
int32_t main(){
	cin >> n >> k;
	int l = 1, r = poww(2,n);
	while(n--){
		int mid = l+r;
		if(mid%2) mid--;
		mid *= poww(2,MOD-2); mid%=MOD;
		if(k%2) k/=2, k++, r = mid;
		else k/=2, l=(mid+1)%MOD;
	}
	cout << l << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Incorrect 1 ms 504 KB Output isn't correct
12 Halted 0 ms 0 KB -