This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include "routers.h"
std::vector<int> find_routers(int l, int n, int q) {
std::vector<int> rs(n);
rs[0] = 0;
int pr = 0;
for(int p = 1; p <= l; p++) {
int r = use_detector(p);
if(r != pr) {
//Calculate distance between routers
rs[r] = 2*p - rs[pr];
if(r > pr) rs[r] -= 2;
//printf("pr %d r %d p %d pp %d p' %d\n", pr, r, p, rs[pr], rs[r]);
pr = r;
p = rs[r] + 1;
}
}
return rs;
}
# | 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... |