# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1097236 |
2024-10-06T14:23:16 Z |
vjudge1 |
Rack (eJOI19_rack) |
C++11 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
000 001 010 011 100 101 110 111
1 5 3 7 2 6 4 8
*/
ll solve(int n, ll k) {
if (n == 1) {
return k;
}
ll base = 1ll<<(n-1), k_reves = 0;
k -= 1;
while (base) {
k_reves += (k%2) * base;
k /= 2;
base /= 2;
}
return k_reves + 1;
}
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
int n;
ll k;
cin >> n >> k;
cout << solve(n, k) << "\n";
cout.flush();
return EXIT_SUCCESS;
}
# |
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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |