답안 #1097235

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097235 2024-10-06T14:22:29 Z vjudge1 Rack (eJOI19_rack) C++11
40 / 100
1 ms 452 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 = 1<<(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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -