Submission #374007

# Submission time Handle Problem Language Result Execution time Memory
374007 2021-03-06T12:16:36 Z vishesh312 Lost in the cycle (IOI19_cycle) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
#include "cycle.h"
using namespace std;

void escape(int N) {
    long long lo = 1, hi = n;
    long long n = N;
    long long a = 0, cur = 0;
    while (lo < hi) {
       long long mid = lo + (hi-lo) / 2;
       cur += (mid + a);
       cur %= n;
       if (jump((mid + a) % n)) {
           hi = mid;
       } else {
           lo = mid+1;
       }
       a = n - mid;
    }
    jump((n/2 + lo + a) % n);
}

Compilation message

cycle.cpp: In function 'void escape(int)':
cycle.cpp:6:28: error: 'n' was not declared in this scope
    6 |     long long lo = 1, hi = n;
      |                            ^