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>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
int n;
void findLocation(int N, int first, int location[], int stype[])
{
n = N;
location[0] = first;
stype[0] = 1;
ii best = {1e9, -1};
for(int i = 1; i< N; i++)
{
best = min(best, {getDistance(0, i), i});
}
int v = best.Y;
int x = best.X;
location[v] = first+x;
stype[v] = 2;
for(int i = 1; i< N; i++)
{
if(i == v) continue;
int xp = getDistance(0, i);
int det = getDistance(v, i);
if(det> xp)
{
location[i] = first+xp;
stype[i] = 2;
}
else
{
location[i] = first-xp+2*x;
stype[i] = 1;
}
}
}
# | 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... |