Submission #1230132

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

vector<int> find_routers(int l, int n, int q) {
  vector<int> ans;
  ans.push_back(0);
  itn road[l];
  memset(road, -1, sizeof(road));
  for(int i = 1; i < n; i++){
    int l = ans.back();
    int r = l - 1;
    int pos = -1;
    while(l > r){
      int m = (l + r) / 2;
      if(road[m] == -1) road[m] = use_detector(m);
      if(road[m] >= i){ 
        r = m - 1;
        pos = m;
      }
      else l = m + 1;
    }
    int tmp = pos - ans[i - 1];
		ans[i] = pos + (tmp - 1) - 1;
  }
	return ans;
}

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:8:3: error: 'itn' was not declared in this scope; did you mean 'int'?
    8 |   itn road[l];
      |   ^~~
      |   int
routers.cpp:9:10: error: 'road' was not declared in this scope; did you mean 'read'?
    9 |   memset(road, -1, sizeof(road));
      |          ^~~~
      |          read