이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "cycle.h"
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 gen(std :: chrono :: system_clock :: now().time_since_epoch().count());
void escape(int n) {
int cur = 0;
auto add = [&](int& x, int y) {
x += y;
if (x >= n) x -= n;
if (x < 0) x += n;
};
int L, R;
if (jump(0)) L = 0, R = n / 2;
else L = n / 2 + 1, R = n - 1;
while (L < R) {
int mid = L + R + 1 >> 1;
if (jump((n - cur + mid) % n)) L = mid;
else R = mid - 1;
add(cur, (n - cur + mid) % n);
}
jump((n - cur + L) % n);
}
컴파일 시 표준 에러 (stderr) 메시지
cycle.cpp: In function 'void escape(int)':
cycle.cpp:28:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
28 | int mid = L + R + 1 >> 1;
| ~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |