Submission #1251900

#TimeUsernameProblemLanguageResultExecution timeMemory
1251900tamzidFinding Routers (IOI20_routers)C++20
Compilation error
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 idx = use_detector(0); // std::vector<int> ans; // for (int i = 0; i < n; i++) { // ans.push_back(0); // } // return ans; std::vector<int> ans; ans.push_back(0); int l = 0, r = l; while(l < r) { int m = (l + r) / 2; if(use_detector(m) == 0) { l = m + 1; } else { r = m - 1; } } ans.push_back((l - 1) * 2); return ans; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:15:7: error: declaration of 'int l' shadows a parameter
   15 |   int l = 0, r = l;
      |       ^
routers.cpp:5:35: note: 'int l' previously declared here
    5 | std::vector<int> find_routers(int l, int n, int q) {
      |                               ~~~~^