# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1252044 | nabeul001 | Finding Routers (IOI20_routers) | C++20 | 0 ms | 0 KiB |
#include "routers.h"
#include<bits/stdc++.h>
using namespace std;
// int use_detector(int x){
// //implement your own, comment this function when submitting
// }
vector<int> find_routers(int l, int n, int q){
//code
vector<int> ans(n,-1);
vector<bool> seen(n,false);
int counter=0;
int call = 0;
for(int i = 0; i <= l && counter<n && call < q; i+=2)
{
int pos = use_detector(i);
call++;
int idx = pos-1;
if(!seen{idx})
{
seen[idx] =true;
ans[idx] = i;
counter++;
}
}
return ans;
}
// comment main function when submitting
// int main(){
// int mx,n,q;
// cin>>mx>>n>>q;
// cout<<"GIVE INPUT:"<<endl;
// find_routers(mx,n,q);
// cout<<"DONE"<<endl;
// return 0;
// }