# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
610489 | Minindu2006 | Rail (IOI14_rail) | C++14 | 381 ms | 716 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 MX = 1e9;
void findLocation(int N, int first, int location[], int stype[])
{
location[0] = first;
stype[0] = 1;
vector<int> curdis1(N, MX), vis(N, 0);
curdis1[0] = 0;
// int cmin = MX, sec = -1;
// for(int i=1;i<N;i++)
// {
// int d = getDistance(0, i);
// curdis1[i] = d;
// if(d < cmin)
// {
// cmin = d;
// sec = i;
// }
// }
// location[sec] = first + cmin, stype[sec] = 2;
// vis[0] = 1;
for (int i = 0; i < N; i++)
{
int nxt, cids = MX;
for (int j = 0; j < N; j++)
{
if (vis[j])
continue;
if (curdis1[j] < cids)
nxt = j, cids = curdis1[j];
}
for (int j = 0; j < N; j++)
{
if (vis[j] || j == nxt)
continue;
int curd = getDistance(nxt, j), delta = (stype[nxt] == 1 ? +1 : -1);
if (curd < curdis1[j])
{
curdis1[j] = curd;
location[j] = location[nxt] + curd * delta;
stype[j] = (stype[nxt] == 1 ? 2 : 1);
}
}
vis[nxt] = 1;
// }
// for(int i=0;i<N;i++)
// cout << location[i] << " ";
// cout << '\n';
}
}
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... |