이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
for (int i = 0; i < N; i++)
location[i] = -1;
location[0] = first, stype[0] = 1;
int cur = 0, mx = 0, mn = 1e9 + 7;
cout << endl;
while (true) {
int curMn = 1e9 + 7, nxt = -1;
for (int i = 0; i < N; i++) {
int dis1 = getDistance(cur, i), dis2 = getDistance(0, i);
if (cur == 0)
cout << i + 1 << " " << dis1 << " " << dis2 << endl;
if ((dis1 < dis2 || !cur) && dis1 < curMn && location[i] == -1)
curMn = dis1, nxt = i;
}
if (nxt == -1)
break;
//cout << cur + 1 << " " << nxt + 1 << endl;
cur = nxt;
int curDis = getDistance(0, cur);
mx = max(mx, curDis), mn = min(mn, curDis);
location[cur] = curDis + first, stype[cur] = 2;
}
//cout << endl;
//for (int i = 0; i < N; i++)
// cout << i << " " << location[i] << endl;
for (int i = 0; i < N; i++) {
if (location[i] != -1)
continue;
//cout << i << endl;
int dis = getDistance(0, i);
dis -= mn;
dis++;
location[i] = first - dis, stype[0] = 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... |