Submission #1308668

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

int totalRooms = 1000000000; int loc = 16543783; int uses = 0;

// bool jump(int x) {
//     cout<<x<<endl;
//     ++uses;
//     loc += x;
//     loc %= totalRooms;
//     return loc > totalRooms/2;
// }

void escape(int rooms) {
    int l = 0, r = rooms, pos = 0;
    while(r - l > 1) {
        cout<<"S "<<l<<' '<<r<<endl;
        int m = (r+l)/2;
        int query = m - pos;
        query += rooms/2;
        query %= rooms;
        pos += query;
        pos %= rooms;
        if (jump(query)) {
            r = m;
        } else {
            l = m;
        }
    }
    jump((l - pos + rooms) % rooms);
}

Compilation message (stderr)

cycle.cpp: In function 'void escape(int)':
cycle.cpp:24:13: error: 'jump' was not declared in this scope
   24 |         if (jump(query)) {
      |             ^~~~
cycle.cpp:30:5: error: 'jump' was not declared in this scope
   30 |     jump((l - pos + rooms) % rooms);
      |     ^~~~