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>
using namespace std;
#ifndef _DEBUG
#include "rail.h"
#endif
#ifdef _DEBUG
int getDistance(int i, int j)
{
return -1;
}
#endif
int n;
vector<bool> found;
void findLocation(int n, int first, int location[], int stype[])
{
::n = n;
location[0] = first;
stype[0] = 1;
int a = 0;
vector<int> distA(n);
vector<int> distB(n);
for (int i = 0; i < n; i++)
distA[i] = getDistance(a, i);
distA[a] = 10000000;
int b = min_element(distA.begin(), distA.end()) - distA.begin();
location[b] = distA[b] + first;
for (int i = 0; i < n; i++)
distB[i] = getDistance(b, i);
distB[b] = 10000000;
for (int i = 0; i < n; i++)
{
if (i == a || i == b)
continue;
if (distA[i] < distB[i])
{
stype[i] = 2;
location[i] = location[a] + distA[i];
}
else
{
stype[i] = 1;
location[i] = location[b] - distB[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... |