#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
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;
| ~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
216 KB |
Output is correct |
9 |
Correct |
1 ms |
224 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
296 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
224 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
292 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
216 KB |
Output is correct |
16 |
Correct |
1 ms |
216 KB |
Output is correct |
17 |
Correct |
1 ms |
216 KB |
Output is correct |
18 |
Correct |
1 ms |
216 KB |
Output is correct |
19 |
Correct |
0 ms |
216 KB |
Output is correct |
20 |
Correct |
1 ms |
216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
216 KB |
Partial score |
2 |
Partially correct |
2 ms |
216 KB |
Partial score |
3 |
Partially correct |
2 ms |
312 KB |
Partial score |
4 |
Partially correct |
2 ms |
216 KB |
Partial score |
5 |
Partially correct |
2 ms |
216 KB |
Partial score |
6 |
Partially correct |
3 ms |
216 KB |
Partial score |
7 |
Partially correct |
2 ms |
312 KB |
Partial score |
8 |
Partially correct |
1 ms |
216 KB |
Partial score |
9 |
Partially correct |
2 ms |
216 KB |
Partial score |
10 |
Partially correct |
2 ms |
216 KB |
Partial score |
11 |
Partially correct |
1 ms |
216 KB |
Partial score |
12 |
Partially correct |
2 ms |
216 KB |
Partial score |
13 |
Partially correct |
1 ms |
332 KB |
Partial score |
14 |
Partially correct |
2 ms |
332 KB |
Partial score |
15 |
Partially correct |
2 ms |
216 KB |
Partial score |
16 |
Partially correct |
2 ms |
216 KB |
Partial score |
17 |
Partially correct |
2 ms |
312 KB |
Partial score |
18 |
Partially correct |
2 ms |
360 KB |
Partial score |
19 |
Partially correct |
2 ms |
320 KB |
Partial score |
20 |
Partially correct |
2 ms |
216 KB |
Partial score |
21 |
Partially correct |
2 ms |
256 KB |
Partial score |