先按照时间顺序加,价值塞进小根堆里,碰到不合法情况就从堆里减去 #include<iostream> #include<cstdio> #include<queue> #include<algorithm> using namespace std; const int N=100005; int n,now; priority_queue<long long>q; struct use { int t; long long v; }a[N]; b…
任务安排1 #include<bits/stdc++.h> #define int long long using namespace std; ; int n,s,t[N],c[N],f[N]; int sumt[N],sumc[N]; signed main(){ scanf("%lld%lld",&n,&s); ;i<=n;i++) scanf(]+t[i],sumc[i]=sumc[i-]+c[i]; memset(f,,sizeof f);…