Submission #48516

#TimeUsernameProblemLanguageResultExecution timeMemory
48516faishol27Gap (APIO16_gap)C++14
30 / 100
89 ms2672 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define PUB push_back

vector<ll>data;

ll subtask1(int N){
	ll 	l = 0,
		r = pow(10,18);
	ll respL, respR;
	ll ans = 0;

	while(data.size() < N){
		MinMax(l, r, &respL, &respR);
		l = respL+1;
		r = respR-1;

		data.PUB(respL);
		if(respL != respR) data.PUB(respR);
	}

	sort(data.begin(), data.end());

	for(int i=0;i<N-1;i++){
		ans = max(ans, data[i+1]-data[i]);
	}

	return ans;
}

long long findGap(int T, int N)
{
	if(T==1) return subtask1(N);
	else return subtask1(N);
	
}

Compilation message (stderr)

gap.cpp: In function 'll subtask1(int)':
gap.cpp:17:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(data.size() < N){
        ~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...