제출 #1225608

#제출 시각아이디문제언어결과실행 시간메모리
1225608tamzidFinding Routers (IOI20_routers)C++20
0 / 100
2095 ms320 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 low = 1;
    int high = l - 1;
    while(low <= high)
    {
      int m = low + (high - low) / 2;
      if(m & 1)
        ++m;
      if(m >= l)
        break;
      if(use_detector(m) == 1)
      {
        low = m + 1;
        if(low < l)
          ans.push_back(low);
      }
      else
      {
        high = m - 1;
      }
    }
    if(ans.size() == 1)
    {
      ans.push_back(l-1);
    }
    return {0,ans.back()};
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...