Submission #975824

# Submission time Handle Problem Language Result Execution time Memory
975824 2024-05-05T23:57:11 Z Isam Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
 
#define eb emplace_back
//#define int long long

constexpr int sz = 1e5 + 5;
constexpr long long inf = (int)1E18 + 7;

long long a[sz];

long long findGap(int T, int N){
	
	long long mn, mx;
	
	MinMax(0ll, (int)1E18, &mn, &mx);
	
	a[1] = mn, a[N] = mx;
	
	for(register int i = 2; i <= N/2 + (N & 1); ++i){
		
		long long l = a[i-1], r = a[N - i + 1];
		
		MinMax(l+1, r-1, &mn, &mx); // called by reference
	
		a[i] = mn, a[N - i + 1] = mx;
		
	}
	
	long long ans = -inf;
	
	
	for(register int i = 2; i <= N; ++i){
		ans = min(ans, a[i] - a[i-1]);
	}
	
	
	return ans;
}

Compilation message

gap.cpp:9:39: error: overflow in constant expression [-fpermissive]
    9 | constexpr long long inf = (int)1E18 + 7;
      |                                       ^
gap.cpp:9:39: error: overflow in constant expression [-fpermissive]
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:21:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |  for(register int i = 2; i <= N/2 + (N & 1); ++i){
      |                   ^
gap.cpp:34:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   34 |  for(register int i = 2; i <= N; ++i){
      |                   ^