Submission #693210

# Submission time Handle Problem Language Result Execution time Memory
693210 2023-02-02T13:09:26 Z testttt Rack (eJOI19_rack) C++14
0 / 100
1000 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 <= 63;i ++){
        if((1 << i) & k){
            ans = (ans + exp(2 , n - i - 1 , mod)) % mod;
        }
    }
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -