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>
using namespace std;
void findLocation(int n, int first, int ans[], int type[]) {
ans[0] = first;
vector<int> a(n), b(n);
type[0] = 1;
int mn = 1e9;
for (int i = 1; i < n; i++) {
a[i] = getDistance(0, i);
b[i] = getDistance(i, 0);
if (a[i] == b[i]) {
type[i] = 2;
ans[i] = first + a[i];
mn = min(mn, a[i]);
} else {
type[i] = 1;
}
}
for (int i = 1; i < n; i++) {
if (type[i] == 1) {
if (a[i] > b[i]) {
ans[i] = first - b[i];
} else {
ans[i] = first + a[i];
}
}
}
}
# | 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... |