Submission #833626

# Submission time Handle Problem Language Result Execution time Memory
833626 2023-08-22T07:15:44 Z tolbi Rack (eJOI19_rack) C++17
40 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
const __int128_t MOD = 1e9+7;
#define tol(bi) (1LL<<((__int128_t)(bi)))
__int128_t solve(__int128_t n, __int128_t k){
	if (n<=70 && k>tol(n-1)){
		return ((__int128_t)solve(n-1,k-tol(n-1))*2ll)%MOD;
	}
	else {
		if (k==1){
			return 1ll;
		}
		if (k%2){
			return solve(n-1,k/2+1);
		}
		else {
			return ((__int128_t)solve(n-1,k/2)+tol(n-1))%MOD;
		}
	}
}
int main(){
	int n,k;
	cin>>n>>k;
	cout<<(long long)solve(n,k)<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 1 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -