제출 #430461

#제출 시각아이디문제언어결과실행 시간메모리
430461schseFinding Routers (IOI20_routers)C++17
100 / 100
5 ms588 KiB
#include "routers.h" #include <bits/stdc++.h> #ifndef EVAL #include "grader.cpp" #endif using namespace std; map<int, int> detus; int dtu; int det(int x) { if (detus.count(x)) return detus[x]; dtu++; return detus[x] = use_detector(x); } int findrouter(int b, int e, int v) { while (e - b != 1) { if (det((e + b) / 2) < v) b = (e + b) / 2; else e = (e + b) / 2; } return b; } std::vector<int> find_routers(int l, int n, int q) { std::vector<int> ans(1, 0); for (int i = 1; i < n; i++) { int t = findrouter(1, l, i); int dist = t - ans.back(); ans.push_back(dist * 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...