제출 #153894

#제출 시각아이디문제언어결과실행 시간메모리
153894songcGap (APIO16_gap)C++14
0 / 100
85 ms4716 KiB
#include <bits/stdc++.h>
#include "gap.h"
#define INF 1'000'000'000'000'000'000ll
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

LL ans, C;
LL Min, Max;
vector<LL> V;

long long findGap(int T, int N){
	MinMax(0, INF, &Min, &Max);
	ans = C = (Max-Min+N-1)/N;
	LL t = Min;
	V.push_back(Min);
	while (t+C <= Max){
		LL x, y;
		MinMax(t+1, min(t+C, Max-1), &x, &y);
		if (x>=0) V.push_back(x);
		if (y>=0) V.push_back(y);
		t += C;
	}
	V.push_back(Max);
	for (int i=0; i<V.size()-1; i++) ans = max(ans, V[i+1]-V[i]);
	return ans;
}

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:25:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0; i<V.size()-1; i++) ans = max(ans, V[i+1]-V[i]);
                ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...