记录编号 383559 评测结果 AAAAAAAAAA
题目名称 [NOIP 2015]跳石头 最终得分 100
用户昵称 GravatarkZime 是否通过 通过
代码语言 C++ 运行时间 0.004 s
提交时间 2017-03-16 07:59:00 内存使用 0.05 MiB
显示代码纯文本
/*kZime*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#define MAXN 50233
using namespace std;
inline int read() {
	int k = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}
/*-----------------------------------------------------------------------------*/
int n, m, c, l, r, w[MAXN]; 

bool check(int mid) {
	int flag = 0;
	int s = 0;
	for(int i = 1; i <= n + 1; i++) {
		if(w[i] - s < mid) flag++;
		else s = w[i];
	}
	if(flag > m) return false;
	else return true;
}

int AC() {
#ifndef MYLAB
	freopen("2015stone.in", "r", stdin);
	freopen("2015stone.out", "w", stdout);
#else
//	freopen("in.txt", "r", stdin);
#endif

	c = read();
	n = read();
	m = read();
	
	for(int i = 1; i <= n; i++) {
		w[i] = read();
	}
	
	l = 0;
	r = w[n + 1] = c;
	
	while(l <= r) {
		int mid = (l + r ) / 2;
		if(check(mid)) l = mid + 1;
		else r = mid - 1; 
	}

	printf("%d", l - 1); 



	return 0;
}
int HA = AC();
int main(){;}