Submission #1118984

# Submission time Handle Problem Language Result Execution time Memory
1118984 2024-11-26T12:55:53 Z Dan4Life Rack (eJOI19_rack) C++17
40 / 100
2 ms 760 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define sz(a) (int)a.size()
using ar2 = array<int,2>;
const int N = (int)1e6+10;
const int INF = (int)1e18;
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(k and l!=r){
		int mid = (l+r)/2;
		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 472 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 472 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 760 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 472 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 760 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Incorrect 1 ms 444 KB Output isn't correct
12 Halted 0 ms 0 KB -