Submission #1092199

#TimeUsernameProblemLanguageResultExecution timeMemory
1092199quan606303Cloud Computing (CEOI18_clo)C++14
0 / 100
82 ms1884 KiB
#include <bits/stdc++.h> #define int long long #define ll long long #define fi first #define se second #define memfull(a,b) memset(a,b,sizeof(a)) #define endl '\n' using namespace std; struct plinh { int sophong,yeucau,tien; }; plinh hotel[2005],customer[2005]; int n,m; const int maxw=2000*50; int dp1[maxw+7],dp2[maxw+7]; void solve() { for (int i=1;i<=maxw;i++)dp1[i]=-1e18; for (int i=1;i<=n;i++) { for (int j=maxw;j>=1;j--) { if (j-hotel[i].sophong>=0&&dp1[j-hotel[i].sophong]!=-1e18)dp1[j]=max(dp1[j],dp1[j-hotel[i].sophong]-hotel[i].tien); } } for (int i=1;i<=m;i++) { for (int j=maxw;j>=1;j--) { if (j-customer[i].sophong>=0)dp2[j]=max(dp2[j],dp2[j-customer[i].sophong]-customer[i].tien); } } int ans=0; for (int i=1;i<=maxw;i++)ans=max(ans,dp2[i]+dp1[i]); cout<<ans; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for (int i=1;i<=n;i++)cin>>hotel[i].sophong>>hotel[i].yeucau>>hotel[i].tien; cin>>m; for (int i=1;i<=m;i++)cin>>customer[i].sophong>>customer[i].yeucau>>customer[i].tien; solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...