Submission #426597

#TimeUsernameProblemLanguageResultExecution timeMemory
426597radaiosm7Finding Routers (IOI20_routers)C++17
100 / 100
2 ms204 KiB
#include <routers.h> #include <bits/stdc++.h> using namespace std; int i, mx[1005]; void compute(int lo, int hi, int x, int y) { if (x == y) return; int mid = (lo+hi)/2; int curr = use_detector(mid); mx[curr] = max(mx[curr], mid); if (x != curr && mid-lo > 1) { compute(lo, mid, x, curr); } if (y != curr && hi-mid > 1) { compute(mid, hi, curr, y); } } vector<int> find_routers(int l, int n, int q) { vector<int> ans(n); fill(mx, mx+n, -1); mx[n-1] = l; compute(0, l, 0, n-1); ans[0] = 0; for (i=1; i < n; ++i) { ans[i] = 2*mx[i-1]-ans[i-1]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...