Submission #1308677

#TimeUsernameProblemLanguageResultExecution timeMemory
1308677raineyjLost in the cycle (IOI19_cycle)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

void escape(int n)
{
    if(n==2) jump(1);
    else
    {
        int l=0, r=n, prev=0;
        bool last=false;
        while(l<r)
        {
            int mid=(l+r)/2;
            if(jump(mid+prev))
            {
                prev+=mid;
                r=mid;
                last=true;
            }
            else 
            {
                l=mid+1;
                prev-=mid;
                last=false;
            }
        }
        if(last==true) jump(n/2);
        else jump((n/2)+1);
    }
}

bool jump(int x) {}

Compilation message (stderr)

cycle.cpp: In function 'void escape(int)':
cycle.cpp:6:14: error: 'jump' was not declared in this scope
    6 |     if(n==2) jump(1);
      |              ^~~~
cycle.cpp:14:16: error: 'jump' was not declared in this scope
   14 |             if(jump(mid+prev))
      |                ^~~~
cycle.cpp:27:24: error: 'jump' was not declared in this scope
   27 |         if(last==true) jump(n/2);
      |                        ^~~~
cycle.cpp:28:14: error: 'jump' was not declared in this scope
   28 |         else jump((n/2)+1);
      |              ^~~~
cycle.cpp: In function 'bool jump(int)':
cycle.cpp:32:19: warning: no return statement in function returning non-void [-Wreturn-type]
   32 | bool jump(int x) {}
      |                   ^