제출 #1092203

#제출 시각아이디문제언어결과실행 시간메모리
1092203quan606303Cloud Computing (CEOI18_clo)C++14
0 / 100
4 ms1116 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); freopen("TEST.INP","r",stdin); freopen("TEST.OUT","w",stdout); 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; }

컴파일 시 표준 에러 (stderr) 메시지

clo.cpp: In function 'int32_t main()':
clo.cpp:45:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     freopen("TEST.INP","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
clo.cpp:46:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |     freopen("TEST.OUT","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...