Submission #1366263

#TimeUsernameProblemLanguageResultExecution timeMemory
1366263vahagngGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
#include "gap.h"
#include <bits/stdc++.h>

long long a[100001];

long long findGap(int T, int N){
	long long mn = 0, mx = 1e18;
	for(int i = 0; i < N / 2; i++){
		MinMax(mn, mx, &mn, &mx);
		a[i] = mn;
		a[N - i - 1] = mx;
	}
	if(N & 1){
		MinMax(mn, mx, &mn, &mx);
		a[(N + 1) / 2] = mn;
	}
	long long res=  0;
	for(int i = 1; i < N; i++){
		res = max(res, a[i] - a[i - 1]);
	}
	return res;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:19:23: error: 'max' was not declared in this scope
   19 |                 res = max(res, a[i] - a[i - 1]);
      |                       ^~~
gap.cpp:19:23: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from gap.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   'std::max'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/bits/ranges_algo.h:2928:29: note:   'std::ranges::max'
 2928 |   inline constexpr __max_fn max{};
      |                             ^~~