Submission #618096

# Submission time Handle Problem Language Result Execution time Memory
618096 2022-08-01T22:10:23 Z hinski2 Rack (eJOI19_rack) C++14
100 / 100
8 ms 7892 KB
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9 + 7;
const int mak = 1e6 + 15;

long long n;
long long ans;
long long k;

long long dp[mak];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	//wczytywanie
	cin >> n >> k;

	dp[0] = 1;
	for(int i = 1; i <= n; i++)
	{
		dp[i] = (dp[i - 1] * 2) % mod;
	}

	k--;
	while(n)
	{
		if(k % 2 == 1)
		{
			ans = (ans + dp[n - 1]) % mod;
		}

		n--;
		k >>= 1;
	}

	ans = (ans + 1) % mod;

	cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 328 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 328 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 724 KB Output is correct
15 Correct 8 ms 7892 KB Output is correct