Submission #693204

# Submission time Handle Problem Language Result Execution time Memory
693204 2023-02-02T13:07:05 Z testttt Rack (eJOI19_rack) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const ll mod = 1e9 + 7;

long long exp(long long x, long long y, long long p) {
	long long res = 1; x %= p;
	while (y) {
		if (y & 1) {
			res *= x; res %= p; 
		}
		x *= x; x %= p;
		y >>= 1;
	}
	return res;
}

int main(){
    ll n , k;cin >> n >> k;
    -- k;
    ll ans = 1;
    for(int i = 0;i <= log(k) + 1;i ++){
        if((1 << i) & k){
            ans = (ans + exp(2 , n - i - 1 , mod)) % mod;
        }
    }
    cout << ans << 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 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 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 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 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 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -