# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429178 | chirathnirodha | Finding Routers (IOI20_routers) | C++17 | 3 ms | 296 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.
//Coded by Chirath Nirodha
#include<bits/stdc++.h>
using namespace std;
#include "routers.h"
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long ll;
vector<int> find_routers(int l, int n, int q) {
vector<int> ans;
if(n==2){
ll a=0,b=l;
while(b-a>1){
ll m=(a+b)/2;
int idx=use_detector(m);
if(idx==0)a=m;
else b=m;
}
ans.PB(0);
ans.PB(2*a);
}
else{
int cur=1;
ans.PB(0);
for(int i=1;i<=l;i++){
int idx=use_detector(i);
if(idx==cur){
ans.PB(ans[ans.size()-1]+(i-1-ans[ans.size()-1])*2);
cur++;
}
if(ans.size()==n)break;
}
}
return ans;
}
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... |