답안 #984439

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
984439 2024-05-16T16:37:01 Z THXuan Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long findGap(ll T, ll N)
{
	ll l = 0,r = 1e18;
	vector<ll>a;
	while(a.size() < N){
		ll mn,mx;
		MinMax(l,r,&mn,&mx);
		a.push_back(mn);
		if(mn == mx)break;
		a.push_back(mx);
		l = mn + 1;
		r = mx - 1;
		if(a.size() == N)break;
	}
	ll ans = 0;
	sort(a.begin(),a.end());
	for(int i=0;i+1<N;i++)ans = max(ans,a[i+1] - a[i]);
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(ll, ll)':
gap.cpp:9:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
    9 |  while(a.size() < N){
      |        ~~~~~~~~~^~~
gap.cpp:17:15: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   17 |   if(a.size() == N)break;
      |      ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccRLk9sW.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status