Submission #929245

# Submission time Handle Problem Language Result Execution time Memory
929245 2024-02-18T04:14:58 Z orgiloogii Rack (eJOI19_rack) C++14
40 / 100
3 ms 2396 KB
#include <bits/stdc++.h>
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define pi pair<int, int>
#define pii pair<pair<int, int>, int>
#define piii pair <int, pair<int, int>>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5;
const long long oo = 1e18;
vector <int> v;
int main() {
	int n, k;
	cin >> n >> k;
	int h = pow(2, n - 1);
	v.resize(h + 1);
	bool b = false;
	if(k % 2 == 0){
		k--;	
		b = true;
	}
	v[1] = 1;
	v[2] = h + 1;
	for(int i = 1;i <= h;i++){
		if(i % 2 == 1){
			v[i] = (v[i / 2 + 1] + 1) / 2;
		}
		else{
			v[i] = v[i-1] + h;
		}
		
		if(v[i] == k){
			if(b) cout << h + i;
			else cout << i;
			return 0;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 436 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 948 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 436 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 948 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Runtime error 3 ms 604 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -