답안 #794259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
794259 2023-07-26T11:33:56 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>

#define long long int;
using namespace std;

int n, k;

int div(int l, int r, int indx, int 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;
	int tot = pow(2, n);
	int extra = 0;
	if (k > tot / 2) {
		k -= (tot / 2);
		extra = 1;
	}
	int ans = div(1, tot, k, 2);
	cout << (ans + extra)%100000007 << "\n";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 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 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 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 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Runtime error 1 ms 300 KB Execution killed with signal 8
12 Halted 0 ms 0 KB -