Submission #1024381

#TimeUsernameProblemLanguageResultExecution timeMemory
102438112345678Finding Routers (IOI20_routers)C++17
100 / 100
1 ms608 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; const int nx=1e3+5; vector<int> f(nx); void solve(int l, int r, int ql, int qr) { if (qr<ql) return; if (l==r) return f[ql]=l, void(); int md=(l+r)/2, t=use_detector(md); solve(l, md, ql, t); solve(md+1, r, t+1, qr); } vector<int> find_routers(int L, int n, int q) { int lst=0; vector<int> res(n); solve(1, L, 1, n-1); for (int i=1; i<n; i++) { int cnt=f[i]-lst-2; res[i]=f[i]+cnt; lst=res[i]; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...