제출 #898302

#제출 시각아이디문제언어결과실행 시간메모리
898302votranngocvyCloud Computing (CEOI18_clo)C++14
100 / 100
983 ms3992 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define piii pair<int,pair<int,int>> #define fi first #define se second const int N = 2e3 + 5; const int inf = 0x3f3f3f3f3f3f3f3f; vector<piii>vec; vector<int>dp_before,dp_cur; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) { int c,f,v; cin >> c >> f >> v; vec.push_back({f,{c,-v}}); } int m; cin >> m; for (int i = 1; i <= m; i++) { int c,f,v; cin >> c >> f >> v; vec.push_back({f,{-c,v}}); } sort(vec.rbegin(),vec.rend()); dp_before.push_back(0); for (int i = 0; i < (int)vec.size(); i++) { dp_cur = dp_before; for (int j = 0; j < dp_before.size(); j++) { int newCnt = j + vec[i].se.fi,newCost = dp_before[j] + vec[i].se.se; if (newCnt >= 0) { while ((int)dp_cur.size() <= newCnt) dp_cur.push_back(-inf); dp_cur[newCnt] = max(dp_cur[newCnt],newCost); } } dp_before = dp_cur; } int ans = 0; for (auto x: dp_before) ans = max(ans,x); cout << ans << "\n"; }

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

clo.cpp: In function 'int main()':
clo.cpp:35:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int j = 0; j < dp_before.size(); j++) {
      |                         ~~^~~~~~~~~~~~~~~~~~
#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...