답안 #975823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975823 2024-05-05T23:55:16 Z Isam Gap (APIO16_gap) C++17
컴파일 오류
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 int inf = (int)1E18;

int a[sz];

int findGap(int T, int N){
	memset(a, -1, sizeof(a));
	
	int 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){
		
		int 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;
		
	}
	
	int ans = -inf;
	
	
	for(register int i = 2; i <= N; ++i){
		ans = min(ans, a[i] - a[i-1]);
	}
	
	
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(long long int, long long int)':
gap.cpp:22:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |  for(register int i = 2; i <= N/2 + (N & 1); ++i){
      |                   ^
gap.cpp:35:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   35 |  for(register int i = 2; i <= N; ++i){
      |                   ^
/usr/bin/ld: /tmp/cc4hORNr.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status