제출 #45031

#제출 시각아이디문제언어결과실행 시간메모리
45031Mamnoon_SiamGap (APIO16_gap)C++17
0 / 100
92 ms2676 KiB
#include <bits/stdc++.h>
using namespace std;

int n, type;

typedef long long ll;

void MinMax(ll, ll, ll*, ll*);

int solve_naive() {
	ll l = 0, r = 1000000000000000000LL;
	vector<ll> v;
	int lim = (n + 1) / 2;
	for(int i=1; i<=lim; i++) {
		ll x, y;
		MinMax(l, r, &x, &y);
		assert(x != -1);
		assert(y != -1);
		v.push_back(x);
		if(x != y) v.push_back(y);
		l = x + 1;
		r = y - 1;
	}
	sort(v.begin(), v.end());
	ll ret = 0;
	for(int i=1; i<v.size(); i++) {
		ret = max(ret, v[i] - v[i-1]);
	} return ret;
}

int solve_proway() {
	return 0;
}

long long findGap(int32_t T, int32_t N)
{
	n = N;
	if(T == 1) return solve_naive();
	else return solve_proway();
	return 0;
}

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

gap.cpp: In function 'int solve_naive()':
gap.cpp:26:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1; i<v.size(); i++) {
               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...