# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
128640 | antimirage | 철로 (IOI14_rail) | C++14 | 86 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include <bits/stdc++.h>
#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
using namespace std;
const int N = 5005;
int dist[2][N];
vector <int> lft;
bool cmp2 (int a, int b) {
return dist[1][a] < dist[1][b];
}
void findLocation(int n, int pos, int a[], int t[])
{
int mx = 0, ind, asd;
a[0] = pos, t[0] = 1;
if (n == 1) return;
for (int i = 1; i < n; i++) {
dist[0][i] = getDistance(0, i);
if (dist[0][i] > mx) {
mx = dist[0][i];
ind = i;
}
}
a[ind] = pos + mx; t[ind] = 2;
for (int i = 1; i < n; i++) {
if (i == ind) continue;
dist[1][i] = getDistance(ind, i);
lft.pb(i);
}
sort(all(lft), cmp2);
int lastc = -1, lastd = ind;
for (int i = 0; i < (int)lft.size(); i++) {
int it = lft[i];
if (lastc == -1) {
lastc = it;
a[it] = a[ind] - dist[1][it];
t[it] = 1;
}
else {
int res = getDistance(lastc, it), nxt = a[ind] - dist[1][it];
if (nxt >= 0 && res == 2 * (a[lastd] - a[lastc]) + a[lastc] - nxt) {
a[it] = nxt, lastc = it; t[it] = 1;
}
else {
a[it] = a[lastc] + res; t[it] = 2;
if (a[lastd] > a[it])
lastd = it;
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |