Submission #1152956

#TimeUsernameProblemLanguageResultExecution timeMemory
1152956_fractalRack (eJOI19_rack)C11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 Rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 1e6 + 200;
const int M = 1e6;
const int inf = 2e9 + 3;
const ll INF = 1e18;

int n, k;
int t[N], used[N];

void upd(int p, int x) {
    p = p + (1<<n) - 1;
    for (int v = p; v >= 1; v /= 2) {
        t[v] += x;
    }
}

bool check() {
    for (int v = 1; v < (1<<n); ++v) {
        int l = t[2 * v];
        int r = t[2 * v + 1];
        if (abs(l - r) > 1) {
            return false;
        }
    }
    return true;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> k;
    for (int i = 1; i <= k; ++i) {
        for (int v = 1; v <= (1<<n); ++v) {
            if (used[v] == 0) {
                upd(v, +1);
                if (check()) {
                    used[v] = 1;
                    if (i == k) {
                        cout << v << '\n';
                    }
                    break;
                }
                else {
                    upd(v, -1);
                }
            }
        }
    }
    
}

Compilation message (stderr)

rack.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.