文章
1
粉丝
0
获赞
0
访问
47
区间调度 + 优先从后往前种
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
struct suggestion
{
int start;
int end;
int tree;
};
bool cmp(suggestion s1, suggestion s2) {
return s1.end < s2.end;
}
int main() {
int n, h;
cin >> n;
cin >> h;
vector<suggestion> date;
for (int i = 0; i < h; i++) {
suggestion tmp;
cin >> tmp.start >> tmp.end >> tmp.tree;
date.push_back(tmp);
}
sort(date.begin(), date.end(), cmp);
vector<int> trees(n + 1);
int result = 0;
for (int i = 0; i < h; i++) {
int current = 0;
for (int j = da...
登录后发布评论
暂无评论,来抢沙发