답안 #251622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
251622 2020-07-22T03:53:52 Z cjoa Lost in the cycle (IOI19_cycle) C++14
33 / 100
1 ms 384 KB
#include "cycle.h"

#include <cstdio>
#include <cassert>

void escape(int n) {
   bool res = jump(0);
   if (!res) {
      res = jump(n/2);
      assert(res);
   }
   int d = 1;
   while (d*4 < n-1)
      d *= 2;
// fprintf(stderr, "d:%d\n", d);

   int offset = 0;
   for (; d > 0; d /= 2) {
      bool res = jump(offset + d);
      if (res) {
         offset = 0;
      }
      else {
         offset = n-d;
      }
   }
   
   if (offset != 0)
      jump(offset);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Incorrect 0 ms 256 KB The exit was not found.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Incorrect 0 ms 256 KB The exit was not found.
8 Halted 0 ms 0 KB -