제출 #433053

#제출 시각아이디문제언어결과실행 시간메모리
433053ACmachineFinding Routers (IOI20_routers)C++17
100 / 100
2 ms684 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; #define FOR(i, j, k, l) for(int i = (j); i < (k); i += (l)) #define FORD(i, j, k, l) for(int i = (j); i >= (k); i -= (l)) #define REP(i, n) FOR(i, 0, n, 1) #define REPD(i, n) FORD(i, n, 0, 1) #define pb push_back typedef long long ll; std::vector<int> find_routers(int l, int n, int q) { vector<int> ans; ans.pb(0); vector<int> mapka(l, -1); auto get = [&](int x){ if(mapka[x] != -1) return mapka[x]; return mapka[x] = use_detector(x); }; function<int(int, int, int)> dfs = [&](int l, int r, int v){ if(r - l <= 1) return l; int m = (l + r) >> 1; if(get(m) <= v) return dfs(m, r, v); else return dfs(l, m, v); }; REP(i, n - 1){ int x = dfs(1, l, i); ans.pb(x + (x - 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...