이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 2;
int dist[N][N];
void findLocation(int N, int first, int location[], int stype[]){
location[0] = first;
stype[0] = 1;
if(N <= 1) return ;
for(int i = 0; i < N; i ++){
for(int j = i + 1; j < N; j ++){
dist[i][j] = dist[j][i] = getDistance(i, j);
}
}
vector <int> rd, rc, ld, lc;
int a = 1, b = 0;
for(int i = 2; i < N; i ++){
if(dist[0][i] < dist[0][a])
a = i;
}
rd.push_back(a);
for(int i = 1; i < N; i ++){
if(i == a) continue;
if(dist[a][i] < dist[a][b])
b = i;
}
if(b)
rc.push_back(b);
for(int i = 1; i < N; i ++){
if(i == a || i == b) continue;
int x = dist[0][i], c = dist[a][i], d = dist[a][b], mn = dist[0][a];
if(x - mn == c - d * 2){
rd.push_back(i);
}
if(x - mn == c)
lc.push_back(i);
}
for(int i : rd){
location[i] = dist[0][i] + first;
stype[i] = 2;
}
for(int i : lc){
location[i] = location[a] - dist[a][i];
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... |