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;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl
void findLocation(int N, int first, int location[], int stype[])
{
lli a,b,MIN,pos;
location[0] = first;
stype[0] = 1;
MIN = 1ll<<62;
pos = N+1;
rep(i,1,N-1) {
a = getDistance(0,i);
if (a < MIN) {
MIN = a;
pos = i;
}
}
location[pos] = first + MIN;
stype[pos] = 2;
rep(i,1,N-1) {
if (i == pos) continue;
a = getDistance(0,i);
b = getDistance(pos,i);
if (a < b) {
stype[i] = 2;
location[i] = first + a;
}
else {
stype[i] = 1;
location[i] = location[pos] - b;
}
}
}
# | 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... |