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 inf = 1e9;
const int N = 5007;
int getDistance(int i, int j);
int d[N][N];
void findLocation(int n, int first, int location[], int stype[]){
location[0] = first;
stype[0] = 1;
int mn = inf, x = 0;
for(int i = 1; i < n; i++){
d[0][i] = getDistance(0, i);
mn = min(mn, d[0][i]);
if(mn == d[0][i]){
x = i;
}
}
for(int i = 1; i < n; i++){
if(i == x){
stype[i] = 2;
location[i] = first + mn;
continue;
}
if(getDistance(i, x) == d[0][i] - mn){
stype[i] = 1;
location[i] = first - (d[0][i] - 2 * mn);
}
else{
stype[i] = 2;
location[i] = first + d[0][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... |