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 <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... |