题目大意:有一个山东用于存放石油,给出山洞的长度n,以及每个位置的底高度以及顶高度,要求存放石油不能没过顶,求最大的放油量。
解题思路:可以发现存放石油的最大高度被顶给限制住了,所以只要找到每个位置上顶得高度即可。
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
const int N = 1e6+5;
const int INF = 0x3f3f3f3f;
struct state {
int c, f;
}s[N];
int n;
vo