Submission #794277

# Submission time Handle Problem Language Result Execution time Memory
794277 2023-07-26T11:59:21 Z Ludissey Rack (eJOI19_rack) C++14
40 / 100
1 ms 340 KB
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <vector>
#include <fstream>
#include <bitset>
#include <tuple>
#include <cmath>
#include <cstdint>
#include <stack>
#include <cassert>
#include <cstdio>
#include <queue>
#include <iterator>
#include <iomanip>
#include <algorithm>
#include <sstream>

using namespace std;

int n, k;

long long div(long long l, long long r, int indx, long long mult) {
	if (r == l + 1) return l;
	int mid= ceil((l + r) / 2.0);
	if (indx % mult == 0) {
		return div(mid, r, indx, mult * 2);
	}
	else {
		return div(l, mid, indx+(mult/2), mult * 2);
	}
}

signed main() {
	cin >> n >> k;
	long long tot = pow(2, n);
	int extra = 0;
	if (k > tot / 2) {
		k -= (tot / 2);
		extra = 1;
	}
	long long ans = div(1, tot, k, 2) + extra;
	long long mod = ans % 1000000007;
	cout << mod << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Runtime error 1 ms 340 KB Execution killed with signal 8
12 Halted 0 ms 0 KB -