Submission #428315

#TimeUsernameProblemLanguageResultExecution timeMemory
428315Popax21Finding Routers (IOI20_routers)C++14
69.65 / 100
2 ms300 KiB
#include <stdio.h> #include "routers.h" int bsearch(int l, int r, int n) { if(l == r-1) return l; int m = l + (r - l) / 2; int mr = use_detector(m); if(mr != n) return bsearch(l, m, n); else return bsearch(m, r, n); } std::vector<int> find_routers(int l, int n, int q) { std::vector<int> rs(n); rs[0] = 0; int pr = 0; for(int c = 1; c < n; c++) { int p = bsearch(rs[pr]+1, l+1, pr)+1; int r = use_detector(p); 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; } return rs; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...