Submission #1146033

#TimeUsernameProblemLanguageResultExecution timeMemory
1146033jklepecGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
#include "gap.h"

long long findGap(int T, int N)
{
  long long L, R;
  MinMax(0, 1e18, &L, &R);
  
  long long diffy = (R - L - 1) / (N - 1) + 1;
  long long sol = diffy;
  
  int last = L;
  for (int i = 0; i < N - 1; i++) {
    long long m, M;
    MinMax(L + i * diffy + 1, R + (i + 1) * diffy, &m, &M);
    sol = max(sol, m - last);
    if (m != -1) last = M;
  }
  
	return max(sol, R - last);
	
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:15:11: error: 'max' was not declared in this scope
   15 |     sol = max(sol, m - last);
      |           ^~~
gap.cpp:19:16: error: 'max' was not declared in this scope
   19 |         return max(sol, R - last);
      |                ^~~