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 location[], int stype[]) {
vector<int> distancesFromZero;
for (int i=0; i<N; i++) {
if (i == 0) {
distancesFromZero.push_back(0); continue;
}
distancesFromZero.push_back(getDistance(0, i));
}
int nextRight = min_element(distancesFromZero.begin(), distancesFromZero.end())-distancesFromZero.begin();
stype[nextRight] = 2;
location[nextRight] = distancesFromZero[nextRight];
vector<int> distancesFromNextRight;
for (int i=0; i<N; i++) {
if (i == nextRight) {
distancesFromNextRight.push_back(0); continue;
}
distancesFromNextRight.push_back(getDistance(0, i));
}
for (int i=0; i<N; i++) {
if (distancesFromZero[nextRight] + distancesFromNextRight[i] == distancesFromZero[i]) {
stype[i] = 1;
location[i] = location[nextRight]-distancesFromNextRight[i];
}
if (distancesFromZero[i] + distancesFromZero[nextRight] == distancesFromNextRight[i]) {
stype[i] = 2;
location[i] = distancesFromZero[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... |