이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 5010;
bool mark[maxn];
int dp[maxn][maxn];
int dist(int a, int b) { return dp[a][b] ? dp[a][b] : dp[a][b] = getDistance(a, b); }
void findLocation(int N, int first, int location[], int stype[])
{
int menor = 0, d = 0x3f3f3f3f;
for(int i = 1; i < N; i++)
if(dist(0, i) < d) menor = i, d = dist(0, i);
location[0] = first;
location[menor] = first + d;
for(int i = 1; i < N; i++) {
if(dist(0, i) == d + dist(menor, i)) location[i] = location[menor] - dist(menor, i);
else location[i] = first + dist(0, i);
}
for(int i = 0; i < N; i++)
if(location[i] <= first) stype[i] = 1;
else stype[i] = 2;
}
| # | 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... |