# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
18689 | suhgyuho_william | Rail (IOI14_rail) | C++98 | 120 ms | 20940 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"
int small,x,v,z,tmp;
int dis[5010][5010];
int where[5010],type[5010];
void findLocation(int N, int first, int location[], int stype[])
{
int i,j;
for(i=0; i<N; i++) location[i] = 999999999;
location[0] = first;
stype[0] = 1;
small = 999999999;
for(i=1; i<N; i++){
dis[0][i] = getDistance(0,i);
if(small > dis[0][i]){
small = dis[0][i];
v = i;
}
}
location[v] = first+small;
stype[v] = 2;
where[0] = first; type[0] = 1; where[v] = location[v]; type[v] = 2;
for(i=1; i<N; i++){
if(i == v) continue;
x = i;
dis[x][v] = getDistance(x,v);
dis[v][x] = getDistance(v,x);
z = dis[0][x]-small;
if(z > 0 && dis[v][x] == dis[x][v] && dis[v][x] == (2*small)+z){
stype[x] = 2;
location[x] = first+small+z;
continue;
}
tmp = dis[0][x]-small;
if(tmp >= 3 && dis[v][x] == (2*small)+tmp && dis[x][v] == dis[v][x]){
stype[x] = 1;
continue;
}
z = dis[v][x]-small;
if(z > 0 && dis[x][v] == dis[v][x] && dis[0][x] == (2*small)+z){
stype[x] = 1;
location[x] = first-z;
continue;
}
}
}
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... |