Submission #1308670

#TimeUsernameProblemLanguageResultExecution timeMemory
1308670CyanberryLost in the cycle (IOI19_cycle)C++20
0 / 100
1 ms404 KiB
#include <bits/stdc++.h>
using namespace std;
#include "cycle.h"

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

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

void escape(int rooms) {
    int l = 0, r = rooms, pos = 0;
    while(r - l > 1) {
        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);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...