제출 #1043934

#제출 시각아이디문제언어결과실행 시간메모리
1043934AC2K산악 구조대 (JOI13_mountain)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

#include "grader.h"

using namespace std;

void Rescue(int R, int C, int RS, int CS, int X) {
    int upper = max(RS - 1, R - RS) + max(CS - 1, C - CS), lower = 0;

    vector<vector<pair<int,int>>> points(upper + 1);
    for (int i = 1; i <= R; ++i) {
        for (int j = 1; j <= C; ++j) {
            points[abs(i - RS) + abs(j - CS)].emplace_back(i, j);
        }
    }

    auto calc = [&](int d) {
        int res = 1e9;

        for (auto [i, j] : points[d]) {
            if (j <= 0 || j > C) continue;

            int H = Measure(i, j);
            if (H == X) {
                Pinpoint(i, j);
                goto escape;
                return res;
            }
            res = min(res, H);
        }

        return res;
    };

    calc(upper);
    calc(lower);

    while (upper - lower > 1) {
        int mid = (upper + lower) / 2;
        int H = calc(mid);
        if (H == -1) return;
        (H >= X ? lower : upper) = mid;
    }

    calc(lower);
    calc(upper);
    
escape:
    return;
}

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

mountain.cpp: In lambda function:
mountain.cpp:26:22: error: label 'escape' used but not defined
   26 |                 goto escape;
      |                      ^~~~~~
mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:48:1: warning: label 'escape' defined but not used [-Wunused-label]
   48 | escape:
      | ^~~~~~