Submission #1225592

#TimeUsernameProblemLanguageResultExecution timeMemory
1225592tamzidFinding Routers (IOI20_routers)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "routers.h"
using namespace std;

vector<int> find_routers(int l, int n, int q) 
{
    vector<int> ans;
    ans.push_back(0);
    int l = 1, r = 100000;
    while(l < r)
    {
      int m = l + (r - l) / 2;
      if(m % 2)
        ++m;
      if(use_detector(m) == 2)
      {
        l = m;
      }
      else
      {
        r = m;
      }
    }
    ans.pb(l);
    return ans;
}

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:9:9: error: declaration of 'int l' shadows a parameter
    9 |     int l = 1, r = 100000;
      |         ^
routers.cpp:5:30: note: 'int l' previously declared here
    5 | vector<int> find_routers(int l, int n, int q)
      |                          ~~~~^
routers.cpp:24:9: error: 'class std::vector<int>' has no member named 'pb'
   24 |     ans.pb(l);
      |         ^~