답안 #225906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
225906 2020-04-22T01:47:21 Z pavement Lost in the cycle (IOI19_cycle) C++17
33 / 100
5 ms 512 KB
#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;

void escape(int n) {
	int cur = 0, lo = 0, hi = n / 2, ans = -1;
	if (jump(n - 1)) {
		if (!jump(1)) {
			jump(n - 1);
			return;
		}
		while (lo <= hi) {
			int mid = (lo + hi) >> 1;
			bool x = jump(mid <= cur ? cur - mid : n - llabs(cur - mid));
			cur = mid;
			if (x) ans = mid, lo = mid + 1;
			else hi = mid - 1;
		}
		jump((ans <= cur ? cur - ans : n - llabs(cur - ans)) + n / 2);
	} else {
		jump(1);
		while (lo <= hi) {
			int mid = (lo + hi) >> 1;
			bool x = jump(mid >= cur ? mid - cur : n - cur + mid);
			cur = mid;
			if (x) ans = mid, hi = mid - 1;
			else lo = mid + 1;
		}
		jump((ans >= cur ? ans - cur : n - cur + ans) + n / 2);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB The exit was not found.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB The exit was not found.
3 Halted 0 ms 0 KB -