이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |