Submission #811015

# Submission time Handle Problem Language Result Execution time Memory
811015 2023-08-06T20:14:18 Z cjoa Lost in the cycle (IOI19_cycle) C++17
0 / 100
0 ms 208 KB
#include "cycle.h"
#include <bits/stdc++.h>

using namespace std;

int cnt_jump = 0;
bool my_jump(int x) {
   ++cnt_jump;
   cout << "Salto #" << cnt_jump << " x = " << x << endl;
   return jump(x);
}

void escape(int n) {
   bool flag = my_jump(0);
   if (!flag) {
      while (true) {
         flag = my_jump(1);
         if (flag) {
            // estoy en el punto medio!!!
            int p;
            if (n % 2 == 0)
               p = n / 2;
            else
               p = n / 2 + 1;
            int dist = n - p;
            my_jump(dist);
            break;
         }
      }
   }
   else {
      while (true) {
         flag = my_jump(1);
         if (!flag) {
            // me pase!!! pero me pase por 1, eso quiere decir que estoy
            // en la habitacion 1
            my_jump(n-1);  // salto n-1 para "regresar" a la habitacion 0
            break;
         }
      }
   }
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -