제출 #434870

#제출 시각아이디문제언어결과실행 시간메모리
434870kevinxiehkFinding Routers (IOI20_routers)C++17
100 / 100
9 ms332 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; int rb[1005]; int ans[1005]; void search(int a) { int l = ans[a - 1] + 1, r = rb[a]; cerr << l << ' ' << r << '\n'; while(l < r) { int m = (l + r + 1) / 2; int x = use_detector(m); for(int i = a; i <= x; i++) rb[i] = min(rb[i], m); if(x == a - 1) l = m; else r = m - 1; } ans[a] = (l - ans[a - 1]) * 2 + ans[a - 1]; return; } vector<int> find_routers(int l, int n, int q) { for(int i = 0; i < n; i++) rb[i] = l; ans[0] = 0; for(int i = 1; i < n; i++) search(i); vector<int> rt; for(int i = 0; i < n; i++) rt.emplace_back(ans[i]); return rt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...