# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042819 | Zicrus | Roller Coaster Railroad (IOI16_railroad) | C++17 | 2044 ms | 10308 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "railroad.h"
using namespace std;
typedef long long ll;
ll plan_roller_coaster(vector<int> s, vector<int> t) {
ll n = s.size();
vector<pair<ll, ll>> a(n);
for (int i = 0; i < n; i++) {
a[i] = {s[i], t[i]};
}
mt19937 mt(time(0));
ll finalRes = 1ll << 62ll;
bool done;
for (int k = 0; k < 1000000; k++) {
shuffle(a.begin(), a.end(), mt);
ll res = 0;
for (int i = 1; i < n; i++) {
res += max(0ll, a[i-1].second - a[i].first);
}
do {
done = true;
for (int i = 1; i < n; i++) {
ll prev = max(0ll, a[i-1].second - a[i].first);
ll nw = max(0ll, a[i].second - a[i-1].first);
if (i > 1) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |