# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
307720 | urd05 | Finding Routers (IOI20_routers) | C++14 | 3 ms | 512 KiB |
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 "routers.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v[1000];
int func(int x) {
int ret=use_detector(x);
v[ret].push_back(x);
return ret;
}
vector<int> find_routers(int l, int n, int q) {
vector<int> ret(n);
int st=0;
vector<int> cut;
for(int i=0;i<n-1;i++) {
int lo=st;
int hi=l;
for(int j=0;j<v[i].size();j++) {
lo=max(lo,v[i][j]);
}
for(int j=i+1;j<n;j++) {
for(int k=0;k<v[j].size();k++) {
hi=min(hi,v[j][k]);
}
}
while (lo+1<hi) {
int mid=(lo+hi)/2;
if (func(mid)==i) {
lo=mid;
}
else {
hi=mid;
}
}
cut.push_back(lo);
st=hi;
}
ret[0]=0;
for(int i=1;i<n;i++) {
ret[i]=cut[i-1]+cut[i-1]-ret[i-1];
}
return ret;
}
Compilation message (stderr)
# | 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... |