제출 #1201491

#제출 시각아이디문제언어결과실행 시간메모리
1201491uranhishigFinding Routers (IOI20_routers)C++20
컴파일 에러
0 ms0 KiB
#include "routers.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> find_routers(int l, int n, int q) {
    int ans = 0;
    vector<int> v={0};
    for (int i = 0; i < l; i++) {
    	if(idx == 1) {
    		ans = i;
    		v.push_back(ans*2 - 2);
    		return v;
		}
		
		int L = 0;
		int R = n;
		while (L + 1 < R) {
			int M = (L + R)/2;
			int idx = use_detector(i);
		}
	}
}

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

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:9:12: error: 'idx' was not declared in this scope
    9 |         if(idx == 1) {
      |            ^~~
routers.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^