Submission #1203346

#TimeUsernameProblemLanguageResultExecution timeMemory
1203346hazuFinding Routers (IOI20_routers)C++20
70.53 / 100
1 ms328 KiB
#include "routers.h"
#include <unordered_map>
using namespace std;

std::vector<int> find_routers(int l, int n, int q) {

    int low,mid,high;
    std::vector<int> ans;
    unordered_map<int, int> mp;
    ans.push_back(0);
    mp[0] = 0;

    for(int i = 1; i < n; i++){
        low = 0;
        high = l;
        mid = (high+low)/2;
        while(low<high){
            mid = (high+low)/2;
            //if(mid == low) break;

            if(use_detector(mid) < i){
                low = mid+1;
            }else {
                high = mid;
            }
        }
        ans.push_back(((low-1) - ans.back()) * 2 + ans.back());
    }

	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...