답안 #1110495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1110495 2024-11-09T15:05:27 Z Newtonabc Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
long long arr[N];
long long findGap(int T, int N)
{
    int aa,bb;
  MinMax(1000,0,aa,bb);
	if(T==1){
		long long ans=LLONG_MIN;
		int lind=1,rind=N;
		long long l=0,r=1e18,mn,mx;
		while(lind<=rind){
			MinMax(l,r,&mn,&mx);
			if(mn==-1) break;
			arr[lind]=mn,arr[rind]=mx;
			lind++,rind--;
			l=mn+1,r=mx-1;
		}
		for(int i=1;i<N;i++){
			ans=max(ans,arr[i+1]-arr[i]);
		}
		/*for(int i=0;i<N;i++) cout<<arr[i] <<" ";
		cout<<"\n\n";*/
		return ans;
	}
	
		
	
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:17: error: invalid conversion from 'int' to 'long long int*' [-fpermissive]
    9 |   MinMax(1000,0,aa,bb);
      |                 ^~
      |                 |
      |                 int
In file included from gap.cpp:1:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:9:20: error: invalid conversion from 'int' to 'long long int*' [-fpermissive]
    9 |   MinMax(1000,0,aa,bb);
      |                    ^~
      |                    |
      |                    int
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^