Submission #210750

#TimeUsernameProblemLanguageResultExecution timeMemory
210750Alexa2001Lost in the cycle (IOI19_cycle)C++17
100 / 100
16 ms380 KiB
#include "cycle.h"
#include <bits/stdc++.h>

using namespace std;

int p, n;

bool go_to_room(int room)
{
    bool res = jump( (room - p + n) % n );
    p = room;
    return res;
}

void escape(int _n) 
{
    n = _n;
    int st = 1, dr = n-1, mid;

    p = 0;

    while(st < dr)
    {
        mid = (st + dr) / 2;
        if(go_to_room((mid - n/2 + n) % n)) dr = mid;
            else st = mid + 1;
    }

    go_to_room(st);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...