# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396866 | bigg | Rail (IOI14_rail) | C++14 | 95 ms | 34244 KiB |
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;
const int MAXN = 5100;
int dist[MAXN][MAXN];
int getdistance(int i, int j){
return getDistance(i,j);
}
void findLocation(int n, int first, int location[], int stype[])
{
location[0] = first, stype[0] = 1;
if(n == 1) return;
int fr, auxfr = 1e9 + 10;
for(int i = 1; i < n; i++){
dist[0][i] = dist[i][0] = getdistance(0,i);
if(dist[i][0] < auxfr) fr = i, auxfr = dist[i][0];
}
for(int i = 1; i < n; i++){
if(i == fr){
location[i] = first + dist[0][i];
stype[i] = 2;
}else{
dist[i][fr] = dist[fr][i] = getdistance(i, fr);
if(dist[i][fr] == dist[0][i] - auxfr){
location[i] = first - (dist[0][i] - 2*auxfr);
stype[i] = 1;
}else{
location[i] = first + dist[0][i];
stype[i] = 2;
}
}
}
return;
}
Compilation message (stderr)
# | 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... |