# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49384 | imeimi2000 | Rail (IOI14_rail) | C++17 | 143 ms | 916 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 "rail.h"
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
const int MAXN = 5000;
int n;
int d0[MAXN];
int d1[MAXN];
int rd[MAXN];
int *l, *t;
void calc(vector<int> &ps, int s) {
sort(ps.begin(), ps.end(), [&](int i, int j) { return rd[i] < rd[j]; });
set<int> mp;
l[ps[0]] = l[s] + rd[ps[0]];
t[ps[0]] = 2;
int mx = ps[0];
mp.insert(l[mx] << 1);
for (int i = 1; i < ps.size(); ++i) {
int fn = (l[mx] << 1) + rd[ps[i]] - rd[mx] - getDistance(ps[i], mx);
if (mp.find(fn) != mp.end()) {
l[ps[i]] = fn - rd[ps[i]] - l[s];
t[ps[i]] = 1;
}
else {
l[ps[i]] = l[s] + rd[ps[i]];
t[ps[i]] = 2;
Compilation message (stderr)
# | 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... |