제출 #844807

#제출 시각아이디문제언어결과실행 시간메모리
844807dutinmeowGap (APIO16_gap)C++17
0 / 100
30 ms3868 KiB
#include "gap.h"

#include <bits/stdc++.h>

template<typename T>
bool chmax(T &a, T b) { 
	if (a >= b)
		return false;
	a = b;
	return true;
}

long long findGap(int t, int n) {
	if (t == 1) {
		std::vector<long long> a;
		a.reserve(n);
		long long bl = 0, br = 1e18;
		for (int i = 0; i < (n + 1) / 2; i++) {
			long long al, ar;
			MinMax(bl, br, &al, &ar);
			a.push_back(al);
			a.push_back(ar);
			bl = al + 1, br = br - 1;
		}
		std::sort(a.begin(), a.end());
		long long r = 0;
		for (int i = 1; i < n; i++)
			chmax(r, a[i] - a[i - 1]);
		return r;
	} else {

	}
}

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...