Submission #1137312

#TimeUsernameProblemLanguageResultExecution timeMemory
1137312viwlesxqBoxes with souvenirs (IOI15_boxes)C++20
Compilation error
0 ms0 KiB
#include "boxes.h"
#include <bits/stc++.h>

using namespace std;

typedef long long i64;

i64 delivery(int n, int k, int l, int p[]) {
    auto dist = [&](int x, int y) {
        if (x > y) swap(x, y);
        return min(y - x, x + n - y);
    };

    i64 res = 0;

    deque<int> q;
    for (int i = 0; i < n; ++i) {
        q.push_back(p[i]);
    }

    int pos = 0;

    while (!p.empty()) {
        if (dist(pos, p.front()) < dist(pos, p.back())) {
            res += dist(pos, p.front());
            pos = p.front();
            p.pop_front();
        } else {
            res += dist(pos, p.back());
            pos = p.back();
            p.pop_back();
        }
    }

    res += dist(pos, 0);

    return res;
}

Compilation message (stderr)

boxes.cpp:2:10: fatal error: bits/stc++.h: No such file or directory
    2 | #include <bits/stc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.