이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "routers.h"
using namespace std;
// l is length
// n is number of routers
// q is max uses of detector
vector<int> find_routers(int l, int n, int q)
{
vector<int> ans(n); // distance of each router i to the origin
if (n == 2)
{
// find position of switch (first point where i = 1) using binary search
int min = 2;
int max = (l / 2) + 1;
while (max - min > 0)
{
int k = (max + min) / 2;
int i = use_detector(k);
if (i == 0)
{
min = k + 1;
}
else
{
max = k;
}
}
ans[1] = min + max - 2;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |