#include <bits/stdc++.h>
#include "railroad.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long
ll plan_roller_coaster(vector<int> in, vector<int> out) {
int n = in.size();
set<array<int, 2>> s;
for (int i = 0; i < n; i++) {
s.insert({in[i], out[i]});
}
vector<array<int, 2>> a;
while (s.size()) {
array<int, 2> val = *s.begin();
s.erase(s.begin());
int st = val[0];
while (1) {
auto it = s.lower_bound({val[1], 0});
if (it == s.end()) {
break;
}
val = *it;
s.erase(it);
}
int en = val[1];
a.push_back({st, en});
}
n = a.size();
ll sum = 0;
for (int i = 0; i < n; i++) {
sum += a[i][1] - a[i][0];
}
ll ans = 1e18;
for (int x = 0; x < n; x++) {
for (int y = 0; y < n; y++) {
if (x == y) continue;
ans = min(ans, sum + a[x][0] - a[y][1]);
}
}
return ans;
}
Compilation message
shortcut.cpp:2:10: fatal error: railroad.h: No such file or directory
2 | #include "railroad.h"
| ^~~~~~~~~~~~
compilation terminated.