Submission #777833

#TimeUsernameProblemLanguageResultExecution timeMemory
777833JoenPoenManFinding Routers (IOI20_routers)C++17
100 / 100
2 ms596 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; unordered_map<int, int> dp; std::vector<int> find_routers(int l, int n, int q) { std::vector<int> sna; int curr = n-1; int low = 0, high = l, mid; while (curr != 0) { while (low != high) { mid = (low+high+1)/2; int res; if (dp.find(mid) != dp.end()) res = dp[mid]; else { res = use_detector(mid); dp[mid] = res; } if (res >= curr) high = mid-1; else low = mid; } sna.push_back(low); high = l; low = 0; curr--; } vector<int> ans; ans.push_back(0); for (int i = sna.size()-1; i >= 0; i--) { ans.push_back(2*sna[i] - 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...