# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174923 | Dan4Life | Cloud Computing (CEOI18_clo) | C++20 | 472 ms | 1424 KiB |
#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a),end(a)
using ll = long long;
const int mxM = 100001;
ll dp[mxM];
vector<array<ll,4>> a;
main(){
for(int t:{-1,1}){
int n,c,f,v; cin >> n;
while(n--) cin>>c>>f>>v, a.push_back({-f,t,c*t,v*t});
}
sort(all(a)); fill(dp+1,dp+mxM,-2e18);
for(auto [f,t,c,v] : a)
for(int j = t==1?0:mxM-1; t==1?j+c<mxM:j>=-c; j+=t)
dp[j] = max(dp[j], dp[j+c]+v);
cout << *max_element(dp,dp+mxM) << "\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |