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 <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
void findLocation(int N, int f, int loc[], int st[]){
st[0] = 1;
loc[0] = f;
int md = 1e9, id = 0;
for(int i = 1; i < N; i ++){
int c = getDistance(0, i);
if(c < md){
md = c;
id = i;
}
}
int nf = f, nid = 0;
for(int i = 1; i < N; i ++){
int c1 = getDistance(0, i);
int c2 = getDistance(id, i);
if(c1 == c2 + md && c2 != 0){
st[i] = 1;
loc[i] = f - c2 + md;
if(loc[i] < nf){
nf = loc[i];
nid = i;
}
}
else{
st[i] = 2;
}
}
for(int i = 1; i < N; i ++){
int c1 = getDistance(nid, i);
if(st[i] == 2){
loc[i] = nf + c1;
}
}
}
# | 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... |