Submission #440817

#TimeUsernameProblemLanguageResultExecution timeMemory
440817SorahISAFinding Routers (IOI20_routers)C++17
72.85 / 100
3 ms360 KiB
#include "routers.h" #pragma GCC optimize("Ofast", "unroll-loops") #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; template<typename T> using Prior = std::priority_queue<T>; template<typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>; #define X first #define Y second #define eb emplace_back #define pb pop_back #define pf pop_front #define ALL(x) begin(x), end(x) #define RALL(x) rbegin(x), rend(x) mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> find_routers(int L, int N, int Q) { vector<int> ans{0}; for (int i = 1; i < N; ++i) { int lo = ans.back() + 1, hi = L, mi; while (lo < hi) { mi = lo + hi + 1 >> 1; if (use_detector(mi) < i) lo = mi; else hi = mi - 1; } ans.eb(2*lo - ans.back()); } return ans; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:27:26: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   27 |             mi = lo + hi + 1 >> 1;
      |                  ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...