이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3;
const int inf = 1e9;
int memo[maxn][maxn];
int get(int i, int j){
if(i == j) return 0;
if(memo[i][j] != -1){
return memo[i][j];
}
return memo[i][j] = getDistance(i, j);
}
void findLocation(int n, int first, int location[], int stype[])
{
for(int i = 0; i < n; i ++){
location[i] = -1;
for(int j = 0; j < n; j ++){
memo[i][j] = -1;
}
}
location[0] = first;
stype[0] = 1;
if(n == 1){
return;
}
int cl = inf + 1, ind = 0;
for(int j = 1; j < n; j ++){
if(cl > get(0, j)){
cl = get(0, j);
ind = j;
}
}
for(int j = 1; j < n; j ++){
if(ind == j){
location[j] = first + cl;
stype[j] = 2;
}else
if(get(0, j) == cl + get(ind, j)){
location[j] = first + cl - get(ind, j);
stype[j] = 1;
}else{
location[j] = first + get(0, j);
stype[j] = 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... |