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;
#ifdef B01
#include "../deb.h"
#else
#define deb(...)
#endif
void findLocation(int n, int p, int location[], int stype[]) {
vector<int> que(1, 0);
vector<int> dist(n, -1);
location[0] = p;
stype[0] = 1;
dist[0] = 0;
for (int b = 0; b < (int) que.size(); b++) {
int i = que[b];
if (stype[i] == -1) {
continue;
}
int mn = INT_MAX;
int mni = -1;
for (int j = 1; j < n; j++) {
if (stype[i] != -1) {
continue;
}
int D = getDistance(i, j);
if (D < mn) {
mn = D;
mni = j;
}
}
que.push_back(mni);
stype[mni] = 3 - stype[i];
if (stype[mni] == 1) {
location[mni] = location[i] - mn;
} else {
location[mni] = location[i] + mn;
}
}
}
# | 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... |