# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
798025 | QwertyPi | 철로 (IOI14_rail) | C++14 | 49 ms | 468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include <bits/stdc++.h>
#define INF (1 << 30)
using namespace std;
int d0[5011], d1[5011];
void findLocation(int N, int first, int location[], int stype[]){
for(int i = 1; i < N; i++) d0[i] = getDistance(0, i); int p0 = 0;
int s = INF, p1; for(int i = 1; i < N; i++) if(d0[i] < s) s = d0[i], p1 = i;
for(int i = 0; i < N; i++) if(i != p1) d1[i] = getDistance(p1, i);
location[p0] = first; stype[p0] = 1;
location[p1] = first + s; stype[p1] = 2;
vector<int> L, R;
for(int i = 0; i < N; i++){
if(i != p0 && i != p1){
if(d0[i] - d1[i] == s) L.push_back(i);
else R.push_back(i);
}
}
sort(L.begin(), L.end(), [](int x, int y){ return d1[x] < d1[y]; });
sort(R.begin(), R.end(), [](int x, int y){ return d0[x] < d0[y]; });
int leftmost = p0;
for(int l : L){
int dis = getDistance(leftmost, l);
if(dis > d1[l] - d1[leftmost]){
location[l] = location[p1] - d1[l]; stype[l] = 1;
leftmost = l;
}else{
location[l] = location[leftmost] + dis; stype[l] = 2;
}
}
int rightmost = p1;
for(int r : R){
int dis = getDistance(rightmost, r);
if(dis > d0[r] - d0[rightmost]){
rightmost = r;
location[r] = location[p0] + d0[r]; stype[r] = 2;
}else{
location[r] = location[rightmost] - dis; stype[r] = 1;
}
}
}
컴파일 시 표준 에러 (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... |