Submission #1161865

#TimeUsernameProblemLanguageResultExecution timeMemory
1161865The_SamuraiPainting Walls (APIO20_paint)C++20
Compilation error
0 ms0 KiB
#include "fun.h"
#include "bits/stdc++.h"
using namespace std;
const int N = 1 << 27;

int code(int bt, int x, int d) {
    return bt | (x << 17) | (d << 22);
}

tuple<int, int, int> decode(int c) {
    int bt = c % (1 << 17); c >>= 17;
    int x = c % (1 << 5); c >>= 5;
    return tuple{bt, x, c};
}

std::vector<int> createFunTour(int n, int q) {
    vector dist(n, vector(n, 0));
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
        dist[i][j] = hoursRequired(i, j);
    }
    
    queue<int> qq;
    map<int, int> par;
    for (int i = 0; i < n; i++) {
        int c = code(1 << i, i, 1);
        qq.push(c); par[c] = 0;
    }

    int way = -1;
    while (!qq.empty()) {
        int c = qq.front(); qq.pop();
        auto [bt, x, d] = decode(c);
        if (bt == (1 << n) - 1) {
            way = c;
            break;
        }
        for (int y = 0; y < n; y++) {
            if (bt & (1 << y)) continue;
            if (dist[x][y] >= d) {
                int nc = code(bt ^ (1 << y), y, dist[x][y]);
                if (par.count(nc)) continue;
                qq.push(nc);
                par[nc] = c;
            }
        }
    }
    assert(way != -1);
    vector<int> ans;
    while (way != 0) {
        auto [bt, x, d] = decode(way);
        ans.emplace_back(x);
        way = par[way];
    }
    return ans;
}

Compilation message (stderr)

paint.cpp:1:10: fatal error: fun.h: No such file or directory
    1 | #include "fun.h"
      |          ^~~~~~~
compilation terminated.