제출 #1329022

#제출 시각아이디문제언어결과실행 시간메모리
1329022orgiloogii철로 (IOI14_rail)C++20
30 / 100
31 ms588 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
void findLocation(int n, int first, int location[], int stype[]) {
    location[0] = first;
    stype[0] = 1;

    int dist[n] = {0};
    dist[0] = 0;

    int mdn = 0;
    int mn = INT_MAX;
    for (int i = 1;i < n;i++) {
        dist[i] = getDistance(0, i);
        if (dist[i] < mn) {
            mn = dist[i];
            mdn = i;
        }
    }
    for (int i = 1;i < n;i++) {
        if (i == mdn) {
            stype[i] = 2;
            location[i] = first + dist[i];
            continue;
        }
        if (dist[mdn] + getDistance(mdn, i) == dist[i]) {
            stype[i] = 1;
            location[i] = first + dist[mdn] - getDistance(mdn, i);
            continue;
        }
        stype[i] = 2;
        location[i] = first + dist[i];
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...