This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
using vi = vector<int>;
using vl = vector<long long>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<long long, long long>>;
#define fur(i, a, b) for(ll i = a; i <= (ll)b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll)b; --i)
#define fr first
#define sc second
#define mp make_pair
#define pb emplace_back
#define nl "\n"
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
void escape(int n) {
ll lo = 0;
ll hi = n;
ll cur = 0;
ll x = 0;
while(lo + 1 != hi) {
ll mid = (lo + hi) / 2;
ll y = mid - n/2;
if(y < 0)
y += n;
x = y - cur;
if(x < 0)
x += n;
// cout << cur << ' ' << lo << ' ' << mid << ' ' << hi << ' ' << y << ' ' << x << nl;
if(jump(x)) {
lo = mid;
} else {
hi = mid;
}
(cur += x) %= n;
}
ll mid = lo;
ll y = mid - n/2;
if(y < 0)
y += n;
x = y - cur;
if(x < 0)
x += n;
jump(x);
jump(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... |