#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
int N;
void solve(int L, int R)
{
if (L > R) R += N;
if (L == R)
{
if (L != 0) jump(N - L);
return;
}
int mid = ((L + R + 1) >> 1) % N, d = (2 * N + 1 - mid) % N;
// cerr << "d = " << d << endl;
if (jump(d)) R = mid - 1;
else L = mid;
L += (d);
R += (d);
L %= N; R %= N;
// cerr << "HI " << L << ' ' << R << endl;
solve(L, R);
}
void escape(int n)
{
N = n;
solve(0, N - 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
The exit was not found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
The exit was not found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
The exit was not found |
3 |
Halted |
0 ms |
0 KB |
- |