제출 #168649

#제출 시각아이디문제언어결과실행 시간메모리
168649dolphingarlic철로 (IOI14_rail)C++14
컴파일 에러
0 ms0 KiB
#include "rail.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll A = 0, B = -1, C = -1, D = -1;
ll from_A[5001], from_B[5001], visited[1000001];

bool left_cmp(ll X, ll Y) { return from_B[X] < from_B[Y]; }
bool right_cmp(ll X, ll Y) { return from_A[X] < from_A[Y]; }

void findLocation(int N, int first, int location[], int stype[]) {
    location[A] = first;
    stype[A] = 1;

    ll min_from_A = ll_MAX;
    for (ll i = 1; i < N; i++) {
        from_A[i] = getDistance(A, i);
        if (from_A[i] < min_from_A) {
            min_from_A = from_A[i];
            B = i;
        }
    }

    location[B] = first + from_A[B];
    stype[B] = 2;

    visited[location[A]] = 1;
    visited[location[B]] = 2;

    vector<ll> left, right;

    for (ll i = 1; i < N; i++) {
        if (i == B) continue;
        from_B[i] = getDistance(B, i);
        if (from_A[i] > from_B[i]) left.push_back(i);
        else right.push_back(i);
    }

    sort(left.begin(), left.end(), left_cmp);
    sort(right.begin(), right.end(), right_cmp);

    C = A;
    for (ll i : left) {
        ll from_C = getDistance(C, i);
        ll z = from_B[i] - from_C - from_B[C];

        if (visited[location[C] - z / 2] == 1) {
            location[i] = location[C] + from_C;
            stype[i] = 2;
        } else {
            location[i] = location[B] - from_B[i];
            stype[i] = 1;
            C = i;
        }

        visited[location[i]] = stype[i];
    }

    D = B;
    for (ll i : right) {
        ll from_D = getDistance(D, i);
        ll z = from_A[i] - from_D - from_A[D];

        if (visited[location[D] + z / 2] == 2) {
            location[i] = location[D] - from_D;
            stype[i] = 1;
        } else {
            location[i] = location[A] + from_A[i];
            stype[i] = 2;
            D = i;
        }

        visited[location[i]] = stype[i];
    }
}

컴파일 시 표준 에러 (stderr) 메시지

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:16:21: error: 'll_MAX' was not declared in this scope
     ll min_from_A = ll_MAX;
                     ^~~~~~
rail.cpp:16:21: note: suggested alternative: 'NL_NMAX'
     ll min_from_A = ll_MAX;
                     ^~~~~~
                     NL_NMAX