洛谷 1938 [USACO09NOV]找工就业Job Hunt 题目描述 Bessie is running out of money and is searching for jobs. Farmer John knows this and wants the cows to travel around so he has imposed a rule that his cows can only make D (1 <= D <= 1,000) dollars in a city be…
题目链接:https://www.luogu.org/problemnew/show/P3398 辣鸡树剖1300ms 倍增大法吼啊 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int maxn = 550000; const int maxlog = 20; int n, m, root, f…
题目大意:给定 N 个物品,每个物品有两个维度的费用,有两个维度的价值,求在有一定费用基础的前提下,满足其中一个维度的价值最大化的前提下,第二个维度的价值最小是多少. 题解:由于是两个维度的价值,因此在 dp 转移决策阶段需要发生改变,来满足题目需求. 代码如下 #include <bits/stdc++.h> using namespace std; const int maxn=110; int n,m,r,mon[maxn],t[maxn],rp[maxn]; int dp[maxn][…