#include "cycle.h"
void escape(int n) {
bool flag = jump(0);
if (!flag) {
while (true) {
flag = jump(1);
if (flag) {
// estoy en el punto medio!!!
int p;
if (n % 2)
p = n / 2;
else
p = n / 2 + 1;
int dist = n - p;
jump(dist);
}
}
}
else {
while (true) {
flag = jump(1);
if (!flag) {
// me pase!!! pero me pase por 1, eso quiere decir que estoy
// en la habitacion 1
jump(n-1); // salto n-1 para "regresar" a la habitacion 0
break;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Too many queries. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Too many queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Too many queries. |
3 |
Halted |
0 ms |
0 KB |
- |