Submission #982520

# Submission time Handle Problem Language Result Execution time Memory
982520 2024-05-14T10:40:56 Z Nomio Rack (eJOI19_rack) C++17
100 / 100
9 ms 8028 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int mod = 1e9 + 7;
int main() {
	int n;
	ll k, S = 0;
	cin >> n >> k;
	ll p[n];
	p[0] = 1;
	for(int i = 1; i < n; i++) {
		p[i] = p[i - 1] * 2;
		p[i] %= mod;
	}
	for(int i = n - 1; i >= 0; i--) {
		if(k % 2 == 0) {
			S += p[i];
			S %= mod;
		}
		k = (k + 1) / 2;
	}
	if(k == 1) {
		S++;
		S %= mod;
	}
	cout << S << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 9 ms 8028 KB Output is correct