Submission #735098

# Submission time Handle Problem Language Result Execution time Memory
735098 2023-05-03T14:39:40 Z makrav Rack (eJOI19_rack) C++14
40 / 100
130 ms 102400 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vei;
typedef vector<vei> vevei;

#define coa               \
            for (auto i : a) {    \
                cout << i << ' '; \
            }                     \
            cout << '\n';
#define cia             \
            for (auto& i : a) { \
                cin >> a;       \
            }
#define cna                       \
            int n;                        \
            cin >> n;                     \
            vector<int> a(n);             \
            for (int i = 0; i < n; i++) { \
                cin >> a[i];              \
            }
#define cnka                      \
            int n, k;                     \
            cin >> n >> k;                \
            vector<int> a(n);             \
            for (int i = 0; i < n; i++) { \
                cin >> a[i];              \
            }
#define cnab                      \
            int n;                        \
            cin >> n;                     \
            vector<int> a(n);             \
            for (int i = 0; i < n; i++) { \
                cin >> a[i];              \
            }                             \
            vector<int> b(n);             \
            for (int i = 0; i < n; i++) { \
                cin >> b[i];              \
            }
#define all(a) (a).begin(), (a).end()
#define sz(a) (int) a.size()
#define con cout << "NO\n"
#define coe cout << "YES\n";
#define str string
#define pb push_back
#define ff first
#define sc second
#define pii pair<int, int>
#define mxe max_element
#define mne min_element
#define stf shrink_to_fit
#define f(i, l, r) for (int i = (l); i < (r); i++)
#define double ld
#define int long long

vector<int> solve(int n) {
    if (n == 1) return { 1, 2 };
    vector<int> res = solve(n - 1), ans;
    f(i, 0, sz(res)) {
        ans.pb(res[i]);
        ans.pb(res[i] + (1 << (n - 1)));
    }
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n, k; cin >> n >> k;
    cout << solve(n)[k - 1] << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 224 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 224 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 1208 KB Output is correct
9 Correct 4 ms 3520 KB Output is correct
10 Correct 14 ms 12720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 224 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 1208 KB Output is correct
9 Correct 4 ms 3520 KB Output is correct
10 Correct 14 ms 12720 KB Output is correct
11 Runtime error 130 ms 102400 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -