Submission #467319

# Submission time Handle Problem Language Result Execution time Memory
467319 2021-08-22T14:55:11 Z ignus Rack (eJOI19_rack) C++14
100 / 100
5 ms 288 KB
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char** argv) {
	int n; long long m; const int pain = 1e9+7;
	cin >> n >> m;
	m--;
	long long n2 = 1;
	for(int i = 0; i < n; i++) {
		n2*=2;
		n2%=pain;
	}
	long long fin=1;
	while(m>0){
		if(n2%2)n2+=pain;
		n2/=2;
		fin+=(m%2)*n2;
		fin%=pain;
		m/=2;
	}
	cout << fin;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 5 ms 288 KB Output is correct