Submission #371948

# Submission time Handle Problem Language Result Execution time Memory
371948 2021-02-27T07:15:23 Z shrek12357 Lost in the cycle (IOI19_cycle) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <iomanip>
#include <assert.h>
#include <bitset>
//#include "cycle.h"
using namespace std;
#define ll long long
//cin.tie(0);ios_base::sync_with_stdio(0);

void solve(int n) {
	int lo = 0, hi = n / 2;
	int cur = 0;
	while (lo < hi) {
		int mid = (lo + hi) / 2;
		cur = mid;
		bool valid;
		if (mid > cur) {
			valid = jump(mid - cur);
		}
		else {
			valid = jump(n - (cur - mid));
		}
		if (valid) {
			hi = mid;
		}
		else {
			lo = mid + 1;
		}
	}
	jump(lo - cur);
	jump(n / 2);
	return;
}

void escape(int n) {
	bool found = jump(0);
	if (found == false) {
		solve(n);
	}
	else {
		if (jump(n / 2)) {
			if (jump(1)) {
				jump(n - 1);
				jump(n / 2);
				return;
			}
			else {
				jump(0);
				return;
			}
		}
		else {
			solve(n);
		}
	}
}

Compilation message

cycle.cpp: In function 'void solve(int)':
cycle.cpp:28:12: error: 'jump' was not declared in this scope
   28 |    valid = jump(mid - cur);
      |            ^~~~
cycle.cpp:31:12: error: 'jump' was not declared in this scope
   31 |    valid = jump(n - (cur - mid));
      |            ^~~~
cycle.cpp:40:2: error: 'jump' was not declared in this scope
   40 |  jump(lo - cur);
      |  ^~~~
cycle.cpp: In function 'void escape(int)':
cycle.cpp:46:15: error: 'jump' was not declared in this scope
   46 |  bool found = jump(0);
      |               ^~~~