이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |