Submission #1258660

#TimeUsernameProblemLanguageResultExecution timeMemory
1258660tamzidFinding Routers (IOI20_routers)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h>
#include "routers.h"
using namespace std;
using ll = long long;

std::vector<int> find_routers(int l, int n, int q) {
    vector<int> answer;
    answer.push_back(0);
    int last = 0;
    for(int i=1;i<n;++i)
    {
      int low = answer.back() + 1, high = l, ans = -1;
      while(low < high)
      {
        int mid = (low + high) / 2;
        if(use_detector(mid) == last)
        {
          low = mid + 1;
        }
        else
        {
          ans = mid;
          high = mid - 1;
        }
        ++last;
        answer.push_back(answer.back() + ((ans - answer.back() - 1) * 2));
      }
    }
    return answer;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...