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 "rail.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 5010;
bool mark[maxn];
int dp[maxn][maxn];
int dist(int a, int b) { return dp[a][b] ? dp[a][b] : dp[a][b] = getDistance(a, b); }
void findLocation(int N, int first, int location[], int stype[])
{
int menor = 0, d = 0x3f3f3f3f;
for(int i = 1; i < N; i++)
if(dist(0, i) < d) menor = i, d = dist(0, i);
location[0] = first;
location[menor] = first + d;
for(int i = 1; i < N; i++) {
if(dist(0, i) == d + dist(menor, i)) location[i] = location[menor] - dist(menor, i);
else location[i] = first + dist(0, i);
}
for(int i = 0; i < N; i++)
if(location[i] <= first) stype[i] = 1;
else stype[i] = 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... |