제출 #229984

#제출 시각아이디문제언어결과실행 시간메모리
229984kshitij_sodaniGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long llo;
#define mp make_pair
#define a first
#define b second
#define pb push_back
#include "gap.h"

/*void MinMax(llo aa,llo bb,llo &cc,llo &dd){
	cout<<aa<<" "<<bb<<endl;
	llo x,y;
	cin>>x>>y;
	cc=x;
	dd=y;
}*/
llo findGap(llo t,llo n){
	if(t==2){
		llo low,high;
		MinMax(0,1e18,&low,&high);
	//	cout<<0<<" "<<(llo)1e18<<endl;
	//	cin>>low>>high;
		llo di=(high-low)/(n-1);
		vector<llo> ans;
		ans.pb(low);
		ans.pb(high);
		for(llo i=low+1;i<=high;i+=di){
			llo ss,tt;
			MinMax(i,i+di-1,&ss,&tt);
		//	cout<<i<<" "<<i+di-1<<endl;
		//	cin>>ss>>tt;
			if(ss==-1 or tt==-1){
				continue;
			}
			ans.pb(ss);
			ans.pb(tt);
		}
		llo ans2=0;
		sort(ans.begin(),ans.end());
		for(llo i=0;i<ans.size()-1;i++){
			ans2=max(ans2,ans[i+1]-ans[i]);
		}
		return ans2;
	}
}

/*int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<findGap(2,4)<<endl;


	return 0;
}*/

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'llo findGap(llo, llo)':
gap.cpp:41:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(llo i=0;i<ans.size()-1;i++){
               ~^~~~~~~~~~~~~
gap.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccJrEfNi.o: In function `main':
grader.cpp:(.text.startup+0x18e): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status