# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171392 | gs18103 | Rail (IOI14_rail) | C++14 | 84 ms | 632 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 <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define em emplace
#define all(v) v.begin(), v.end()
#define report(x, l, s) stype[x] = s, location[x] = l, chk[x] = true
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const int MAX = 5050;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
int d[4][MAX];
bool chk[MAX], LR[MAX];
void findLocation(int n, int l0, int location[], int stype[]) {
report(0, l0, 1);
int mi = INF, i1, i2;
for(int i = 1; i < n; i++) {
d[0][i] = getDistance(0, i);
if(d[0][i] < mi) {
mi = d[0][i], i1 = i;
}
}
report(i1, l0 + mi, 2);
int ma = 0;
for(int i = 1; i < n; i++) {
if(chk[i]) continue;
d[1][i] = getDistance(i1, i);
if(d[0][i] == d[0][i1] + d[1][i]) {
report(i, location[i1] - d[1][i], 1);
}
else {
report(i, location[0] + d[0][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... |