제출 #1038622

#제출 시각아이디문제언어결과실행 시간메모리
1038622eysbutnoFinding Routers (IOI20_routers)C++17
100 / 100
3 ms724 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = array<int, 2>; #define all(x) begin(x), end(x) #define sz(x) (int) (x).size() #include "routers.h" vector<int> find_routers(int l, int n, int q) { vector<int> res(n), lb(n); set<pii> seen; for (int i = 1; i < n; i++) { int lo = max(res[i - 1] + 1, lb[i - 1]); int hi = l - 1; auto it = seen.lower_bound({i, -1}); if (it != end(seen)) { hi = (*it)[1] - 1; } while (lo < hi) { int mi = (lo + hi + 1) / 2; int x = use_detector(mi); lb[x] = max(lb[x], mi); seen.insert({x, mi}); (x == i - 1) ? lo = mi : hi = mi - 1; } res[i] = res[i - 1] + 2 * (lo - res[i - 1]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...