# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1175472 | Dan4Life | Cloud Computing (CEOI18_clo) | C++20 | 500 ms | 1352 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
long long n,c,f,v,dp[N];
vector<array<long long,4>> a;
main(){
for(int t:{-1,1}){ cin >> n;
while(n--) cin>>c>>f>>v, a.push_back({-f,t,c*t,v*t});
}
sort(begin(a),end(a)); fill(dp+1,dp+N,-2e18);
for(auto [f,t,c,v] : a)
for(int j = t==1?0:N-1; t==1?j+c<N:j>=-c; j+=t)
dp[j] = max(dp[j], dp[j+c]+v);
cout << *max_element(dp,dp+N) << "\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... |