제출 #1251899

#제출 시각아이디문제언어결과실행 시간메모리
1251899kolpo0210Finding Routers (IOI20_routers)C++20
컴파일 에러
0 ms0 KiB

#include <bits/stdc++.h>
using namespace std;

int use_detector(int);

int[] find_routers(int l, int n, int q) {
    vector<int> pos(n);
    pos[0] = 0;

    for (int i = 1; i < n; ++i) {
        int lo = pos[i-1] + 2, hi = l, mid, res = l;

        while (lo <= hi) {
            mid = ((lo + hi) / 2) / 2 * 2;
            int label = use_detector(mid);
            if (label >= i + 1) {
                res = mid;
                hi = mid - 2;
            } else {
                lo = mid + 2;
            }
        }

        pos[i] = 2 * res - pos[i - 1];
    }

    return pos;
}

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

routers.cpp:7:4: error: structured binding declaration cannot have type 'int'
    7 | int[] find_routers(int l, int n, int q) {
      |    ^~
routers.cpp:7:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
routers.cpp:7:4: error: empty structured binding declaration
routers.cpp:7:7: error: expected initializer before 'find_routers'
    7 | int[] find_routers(int l, int n, int q) {
      |       ^~~~~~~~~~~~