Submission #1203342

#TimeUsernameProblemLanguageResultExecution timeMemory
1203342hazuFinding Routers (IOI20_routers)C++20
77.93 / 100
3 ms840 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); for(int i = 1; i < n; i++){ low = ans.back(); high = l; mid = (high+low)/2; while(low<high){ int detected = 0; mid = (high+low)/2; //if(mid == low) break; if(mid > 0 && mp[mid] > 0){ detected = mp[mid]; }else { detected = use_detector(mid); mp[mid] = detected; } if(detected == i-1){ 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...