제출 #1324506

#제출 시각아이디문제언어결과실행 시간메모리
1324506jack205Mobile (BOI12_mobile)C++20
컴파일 에러
0 ms0 KiB
struct Seg { double L, R; };
vector<Seg> stk;
stk.reserve(n);

auto ok = [&](double mid)->bool {
    stk.clear();
    double r2 = mid * mid;

    for (int i = 1; i <= n; i++) {
        double x = a[i].first, y = a[i].second;
        double yy = y * y;
        if (r2 < yy) continue;                 // 无效点直接跳过

        double dx = sqrt(max(0.0, r2 - yy));
        double L = x - dx, R = x + dx;

        while (!stk.empty() && stk.back().L >= L - eps) stk.pop_back();
        stk.push_back({L, R});
    }

    double cur = 0;
    for (auto &s : stk) {
        if (s.L > cur + eps) return false;
        cur = max(cur, s.R);
        if (cur >= l - eps) return true;       // 提前结束
    }
    return cur >= l - eps;
};

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

mobile.cpp:2:1: error: 'vector' does not name a type
    2 | vector<Seg> stk;
      | ^~~~~~
mobile.cpp:3:1: error: 'stk' does not name a type
    3 | stk.reserve(n);
      | ^~~
mobile.cpp:5:12: error: non-local lambda expression cannot have a capture-default
    5 | auto ok = [&](double mid)->bool {
      |            ^
mobile.cpp: In lambda function:
mobile.cpp:6:5: error: 'stk' was not declared in this scope; did you mean 'std'?
    6 |     stk.clear();
      |     ^~~
      |     std
mobile.cpp:9:26: error: 'n' was not declared in this scope
    9 |     for (int i = 1; i <= n; i++) {
      |                          ^
mobile.cpp:10:20: error: 'a' was not declared in this scope
   10 |         double x = a[i].first, y = a[i].second;
      |                    ^
mobile.cpp:11:21: error: 'y' was not declared in this scope; did you mean 'yy'?
   11 |         double yy = y * y;
      |                     ^
      |                     yy
mobile.cpp:14:26: error: 'max' was not declared in this scope
   14 |         double dx = sqrt(max(0.0, r2 - yy));
      |                          ^~~
mobile.cpp:14:21: error: 'sqrt' was not declared in this scope
   14 |         double dx = sqrt(max(0.0, r2 - yy));
      |                     ^~~~
mobile.cpp:17:52: error: 'eps' was not declared in this scope
   17 |         while (!stk.empty() && stk.back().L >= L - eps) stk.pop_back();
      |                                                    ^~~
mobile.cpp:23:25: error: 'eps' was not declared in this scope
   23 |         if (s.L > cur + eps) return false;
      |                         ^~~
mobile.cpp:24:15: error: 'max' was not declared in this scope
   24 |         cur = max(cur, s.R);
      |               ^~~
mobile.cpp:25:20: error: 'l' was not declared in this scope
   25 |         if (cur >= l - eps) return true;       // 提前结束
      |                    ^
mobile.cpp:25:24: error: 'eps' was not declared in this scope
   25 |         if (cur >= l - eps) return true;       // 提前结束
      |                        ^~~
mobile.cpp:27:19: error: 'l' was not declared in this scope
   27 |     return cur >= l - eps;
      |                   ^
mobile.cpp:27:23: error: 'eps' was not declared in this scope
   27 |     return cur >= l - eps;
      |                       ^~~