Submission #439427

#TimeUsernameProblemLanguageResultExecution timeMemory
439427Tc14Finding Routers (IOI20_routers)C++17
65.68 / 100
2 ms296 KiB
#include <bits/stdc++.h> #include "routers.h" using namespace std; #define ve vector typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 10; int L; int use(int x) { if (x > L) return INF; else return use_detector(x); } ve<int> find_routers(int l, int n, int q) { ve<int> Ans(n); L = l; int p = 0; for (int i = 1; i < n; i++) { int x = 2; while (use(p + x) == i - 1) { x <<= 1; } int a = p + x; x >>= 1; while (x != 0) { if (use(a - x) != i - 1) { a -= x; } x >>= 1; } p = p + 2 * (a - p - 1); Ans[i] = p; } 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...