이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "rail.h"
using namespace std;
#define dist first
#define idx second
typedef pair<int,int> pii;
const int MN = 5001;
pii station[MN];
void findLocation(int N, int first, int location[], int stype[]) {
for (int i=0; i<N; ++i) {
station[i].dist = getDistance(0, i);
station[i].idx = i;
}
sort(station+1, station+N);
int closest = station[1].idx;
int mdst = station[1].dist;
location[0] = first;
location[closest] = first + mdst;
for (int i=2; i<N; ++i) {
int cur = getDistance(closest, station[i].idx);
if (mdst + cur == station[i].dist) {
int offset = station[i].dist - (mdst * 2);
location[station[i].idx] = first - offset;
} else {
location[station[i].idx] = first + station[i].dist;
}
}
for (int i=0; i<N; ++i) {
stype[i] = (location[i] <= first ? 1 : 2);
}
}
# | 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... |