#include <bits/stdc++.h>
#include "cycle.h"
using namespace std;
bool jump(int x);
int pp=5;
void escape(int n) {
int rem=0;
for(int i = n/2 ; i >= 1 ; i/=2) {
//cout << pp << " " << rem << "\n";
if(!jump(i + rem)) {
rem = n - i;
} else rem=0;
}
if(!jump(0)) jump(n-1);
}
/*
//#include "cycle.h"
#include <cstdio>
#include <cassert>
#include <string>
using namespace std;
static const int cnt_lim = 35;
static int n, p, cnt;
[[noreturn]] inline static void wrong_answer(string reason) {
printf("%s\n", reason.c_str());
fclose(stdout);
exit(0);
}
bool jump(int x) {
pp+=x;
pp%=n;
if (x < 0 || x >= n)
wrong_answer("Invalid argument.");
cnt++;
if (cnt > cnt_lim)
wrong_answer("Too many queries.");
p = (p + x) % n;
return (n - p) % n <= n / 2;
}
int main() {
assert(1 == scanf("%d", &n));
assert(1 == scanf("%d", &p));
fclose(stdin);
cnt = 0;
escape(n);
if (p != 0)
wrong_answer("The exit was not found.");
printf("OK\n");
fprintf(stderr, "%d\n", cnt);
fclose(stdout);
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Incorrect |
0 ms |
200 KB |
The exit was not found. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
The exit was not found. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Incorrect |
0 ms |
200 KB |
The exit was not found. |
4 |
Halted |
0 ms |
0 KB |
- |