fork download
  1. #include "routers.h"
  2. #ifdef MINA
  3. #include "grader.cpp"
  4. #endif
  5. #include <bits/stdc++.h>
  6. using namespace std;
  7.  
  8. vector<int> ans, dist;
  9.  
  10. void bs(int s, int e, int a, int b) {
  11. if (a > b) return;
  12. if (e - s == b - a) {
  13. for (int i = s; i <= e; i++) {
  14. dist.push_back(i);
  15. }
  16. return;
  17. }
  18. if (s + 1 == e) {
  19. if (use_detector(e) == a) {
  20. dist.push_back(e);
  21. } else {
  22. dist.push_back(s);
  23. }
  24. return;
  25. }
  26. int m = (s + e) / 2;
  27. int hi = use_detector(m);
  28. bs(s, m - 1, a, hi - 1);
  29. bs(m, e, hi, b);
  30. }
  31.  
  32. vector<int> find_routers(int l, int n, int q) {
  33. bs(0, l, 0, n - 2);
  34. ans.resize(n);
  35. ans[0] = 0;
  36. for (int i = 1; i < n; i++)
  37. {
  38. ans[i] = 2 * dist[i - 1] - ans[i - 1];
  39. }
  40. return ans;
  41. }
  42.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:10: fatal error: routers.h: No such file or directory
 #include "routers.h"
          ^~~~~~~~~~~
compilation terminated.
stdout
Standard output is empty