이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#include "cycle.h"
bool test(int x, int jumps, int n) {
int t = (jumps - x + n) % n;
//cout << t << "\n";
return jump(t);
}
void escape(int n) {
if (!jump(0)) {
ll high = n/2;
ll low = 0;
ll cur = 0;
while (high - low > 1) {
ll mid = (high + low) / 2;
//cout << low << " " << mid << " " << high << "\n";
if (test(cur,mid,n) == false) low = mid;
else high = mid;
cur = mid;
}
test(cur,high + n/2,n);
} else {
ll high = n/2+1;
ll low = 0;
ll cur = 0;
while (high - low > 1) {
ll mid = (high + low) / 2;
//cout << low << " " << mid << " " << high << "\n";
if (test(cur,mid,n) == true) low = mid;
else high = mid;
cur = mid;
}
//cout << cur << " " << low << " " << high << "\n";
test(cur,low,n);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |