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;
const int MAXN = 5e3 + 10;
int Dist[MAXN][MAXN];
void findLocation(int N, int first, int location[], int stype[])
{
location[0] = first; stype[0] = 1;
// Rever na ultima parcial
for (int i = 0; i < N; i++)
{
for (int j = i+1; j < N; j++)
{
Dist[i][j] = Dist[j][i] = getDistance(i, j);
}
}
int leastDistant = 1;
for (int i = 1; i < N; i++) if (Dist[0][i] < Dist[0][leastDistant]) leastDistant = i;
location[leastDistant] = first + Dist[0][leastDistant]; stype[leastDistant] = 2;
for (int i = 1; i < N; i++)
{
if (i == leastDistant) continue;
if (Dist[0][i] < Dist[leastDistant][i])
{
location[i] = location[0] + Dist[0][i];
stype[i] = 2;
}
else
{
location[i] = location[leastDistant] - Dist[leastDistant][i];
stype[i] = 1;
}
}
}
# | 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... |