제출 #980744

#제출 시각아이디문제언어결과실행 시간메모리
980744CSQ31Gap (APIO16_gap)C++17
30 / 100
39 ms4240 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
long long findGap(int T, int N)
{
	long long int 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;
}

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and '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 'int' [-Wsign-compare]
   17 |   if(a.size() == N)break;
      |      ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...