이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cycle.h"
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void escape(int n){
bool curval = jump(0);
if(curval == false)
jump(n/2);
int idx = 0;
int l = 1, r = n-1;
while(l < r){
int mid = (l+r+1)/2;
int jumpval = mid-idx;
if(jumpval < 0)
jumpval += n;
curval = jump(jumpval);
idx = mid;
if(curval){
if(mid < n-n/2)
l = mid+1;
else if(mid > n/2)
r = mid-1;
else{
idx = (idx+1)%n;
curval = jump(1);
if(curval){
l = mid-1;
break;
}
else{
l = n-1;
break;
}
}
}
else
l = mid;
}
l = (l+n/2+1)%n;
int jumpval = l-idx;
if(jumpval < 0)
jumpval += n;
jump(jumpval);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |